frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Myna: Monospace typeface designed for symbol-heavy programming languages

https://github.com/sayyadirfanali/Myna
171•birdculture•5h ago•69 comments

How did I get here?

https://how-did-i-get-here.net/
91•zachlatta•3h ago•29 comments

Ruby Solved My Problem

https://newsletter.masilotti.com/p/ruby-already-solved-my-problem
139•joemasilotti•4h ago•54 comments

Becoming a Compiler Engineer

https://rona.substack.com/p/becoming-a-compiler-engineer
27•lalitkale•1h ago•3 comments

YouTube Removes Windows 11 Bypass Tutorials, Claims 'Risk of Physical Harm'

https://news.itsfoss.com/youtube-removes-windows-11-bypass-tutorials/
264•WaitWaitWha•2h ago•92 comments

Ribir: Non-intrusive GUI framework for Rust/WASM

https://github.com/RibirX/Ribir
35•adamnemecek•3h ago•4 comments

Venn Diagram for 7 Sets

https://moebio.com/research/sevensets/
83•bramadityaw•3d ago•14 comments

Transducer: Composition, Abstraction, Performance

https://funktionale-programmierung.de/en/2018/03/22/transducer.html
58•defmarco•3d ago•0 comments

Why is Zig so Cool?

https://nilostolte.github.io/tech/articles/ZigCool.html
5•vitalnodo•37m ago•0 comments

VLC's Jean-Baptiste Kempf Receives the European SFS Award 2025

https://fsfe.org/news/2025/news-20251107-01.en.html
193•kirschner•3h ago•31 comments

FAA restricts commercial rocket launches indefinitely due to air traffic risks

https://www.space.com/space-exploration/launches-spacecraft/faa-restricts-commercial-rocket-launc...
29•bookmtn•42m ago•2 comments

Leaving Meta and PyTorch

https://soumith.ch/blog/2025-11-06-leaving-meta-and-pytorch.md.html
665•saikatsg•17h ago•162 comments

I Love OCaml

https://mccd.space/posts/ocaml-the-worlds-best/
279•art-w•9h ago•189 comments

James Watson has died

https://www.nytimes.com/2025/11/07/science/james-watson-dead.html
189•granzymes•4h ago•90 comments

Angel Investors, a Field Guide

https://www.jeanyang.com/posts/angel-investors-a-field-guide/
83•azhenley•6h ago•16 comments

Show HN: VoxConvo – "X but it's only voice messages"

https://voxconvo.com
4•siim•1h ago•1 comments

Using the Web Monetization API for fun and profit

https://blog.tomayac.com/2025/11/07/using-the-web-monetization-api-for-fun-and-profit/
6•tomayac•1h ago•1 comments

Denmark's government aims to ban access to social media for children under 15

https://apnews.com/article/denmark-social-media-ban-children-7862d2a8cc590b4969c8931a01adc7f4
370•c420•7h ago•264 comments

How a devboard works (and how to make your own)

https://kaipereira.com/journal/build-a-devboard
3•kaipereira•1h ago•0 comments

Developers in C-Level Meetings

https://radekmie.dev/blog/on-developers-in-c-level-meetings/
10•keyle•6d ago•0 comments

I'm making a small RPG and I need feeback regarding performance

https://jslegenddev.substack.com/p/im-making-a-small-rpg-and-i-need
60•ibobev•9h ago•55 comments

Understanding traffic

https://dr2chase.wordpress.com/
25•kunley•4d ago•17 comments

Objective-C for Windows, including UIKit (public archive). From Microsoft

https://github.com/microsoft/WinObjC
8•zerr•5d ago•2 comments

Apple is crossing a Steve Jobs red line

https://kensegall.com/2025/11/07/apple-is-crossing-a-steve-jobs-red-line/
218•zdw•3h ago•193 comments

PyTorch Helion

https://pytorch.org/blog/helion/
127•jarbus•5d ago•39 comments

Sweep (YC S23) is hiring to build autocomplete for JetBrains

https://www.ycombinator.com/companies/sweep/jobs/8dUn406-founding-engineer-intern
1•williamzeng0•11h ago

My Experience of building Bytebeat player in Zig

https://blog.karanjanthe.me/posts/zig-beat/
76•KMJ-007•3d ago•11 comments

Meta projected 10% of 2024 revenue came from scams

https://sherwood.news/tech/meta-projected-10-of-2024-revenue-came-from-scams-and-banned-goods-reu...
616•donohoe•11h ago•464 comments

AI is Dunning-Kruger as a service

https://christianheilmann.com/2025/10/30/ai-is-dunning-kruger-as-a-service/
172•freediver•1h ago•138 comments

Show HN: Three Emojis, a daily word puzzle for language learners

https://threeemojis.com/en-US/play/hex/en-US/2025-11-07
18•knuckleheads•4h ago•17 comments
Open in hackernews

Ruby Solved My Problem

https://newsletter.masilotti.com/p/ruby-already-solved-my-problem
139•joemasilotti•4h ago

Comments

iagooar•4h ago
Ruby has a lot of these hidden gems (pun intended).

I wouldn't be as much in love with programming, if it wasn't for Ruby. And although I use many other programming languages these days, Ruby will forever have a special place in my heart.

matltc•4h ago
Agreed. Was looking around for STL files so I could print a ruby and put it on my desk.

Glad to see it's getting love on here recently.

amerine•4h ago
I love this idea!! Any luck finding an STL or at least a 3d model I can convert and copy your idea?
jonah•3h ago
A quick search returned this: https://sketchfab.com/3d-models/gemstone-pack-68c4ec3dd23247...

Not _exactly_ the same cut, but might be good enough for you?

netghost•2h ago
A long while back I wrote a bunch of articles covering some of the standard library: https://snakeshands.com/series/ruby_standard_library/

Ruby, and Ruby on Rails is a treasure trove of little handy bits you can use if you just know where to look. I really miss some aspects of ruby (I just don't have a chance to use it these days).

c-hendricks•4h ago
title is actually "Ruby already solved my problem"
throwaway81523•4h ago
Thanks, that helped. My unspoken question when I saw the title was "does that mean you now have two problems?".
adverbly•4h ago
If you ignore performance and mathematical elegance and safety and just look at how much a language lets you get away with from a productivity standpoint, I think Ruby is a pretty standout winner and nobody else even comes close really...

Very clear APIs and syntax(with the possible exception of blocks which can be weird because they aren't quite functions), and tons of raw metaprogramming powers.

You can argue it sacrifices too much of the other things to deliver on these things, but it's hard to argue against it doing well at what it optimizes for!

jnovek•4h ago
I love writing Ruby. It’s one of the most pleasant and elegant languages I’ve used… but the footguns it comes equipped with rival those of Perl.
fhars•3h ago
Does Base https://github.com/garybernhardt/base still work with current versions?
jimbokun•1h ago
Various Lisps can give it a run for its money, depending on the problem.

Metaprogramming is Lisp's canonical super power. Ruby is going to win out on tasks where it has built in syntax, like matching regular expressions.

But once you get to metaprogramming Lisp macros are going to give Ruby a run for its money.

I will say one of the under appreciated aspects of Ruby is the consistency of its semantics, where everything is message passing very much like Smalltalk.

shevy-java•1h ago
Right. But ruby also has awful crap. The documentation - look at opal, webassembly and many other projects in ruby. The documentation is just total garbage.

rubygems.org also has decided to, rather than fix on existing problems, eliminate all former maintainers and instead put in Hiroshi Shibata as the solo lead - the same guy who keeps on writing on different github issue trackers how he does not have time to handle any issue requests for low-used projects. Wowsers.

chihuahua•1h ago
"If you ignore performance and safety..."

Other than that, how was the play, Mrs. Lincoln?

Also, add readability and maintainability to that list, and scaling to a large codebase. And good debugger support.

lloeki•4h ago
> it’s built into Ruby!

Nitpick: technically `Gem::Version` is part of `rubygems`, and while `rubygems` is (typically) packaged with Ruby, it's actually entirely optional, so much so that `rubygems` actually monkeypatches† Ruby core's `Kernel` (notably `require`) to inject gem functionality.

MRuby has none of it, and CRuby has a `--disable-rubygems` configure flag.

Back in 1.8 days, you even had to manually require `rubygems`!

† https://github.com/ruby/rubygems/tree/4e4d2b32353c8ded870c14...

dragonwriter•2h ago
Nitpicking your nitpick, but Ruby’s standard library has three components:

* default libraries (these are maintained by the Ruby core team, delivered with Ruby, and upgraded only as part of Ruby version upgrades.)

* default gems (these are maintained by the Ruby core team, delivered with Ruby, not removable, can be required directly just like default libraries, but can be updated separately from Ruby version upgrades.)

* bundled gems (these are gems that are delivered and installed with Ruby, but which can be upgraded separately or removed.)

Rubygems is a default gem. [0] It used to not be part of the standard library, but it has been since Ruby 1.9, released in 2007.

[0] see, https://stdgems.org/

skrebbel•3h ago
Unrelated side note, but I haven't written any Ruby in maybe 15 years or so and dammn I forgot how elegant the language is at its core. The author's AppVersion class is so nicely done, it's nuts how succinct eg the compare implementation is.

Having done mostly TypeScript and Elixir lately, I had forgotten things could be so succinct yet so clear. The combo of modern (to me) Ruby's lambda syntax (in the .map call), parentheses-less function calls, the fact that arrays implement <=> by comparing each item in order, that there's an overloadable compare operator at all, having multiple value assignments in one go... It all really adds up!

In any other language I can think of real quick (TS, Elixir, C#, Python, PHP, Go) a fair number of these parts would be substantially more wordy or syntaxy at little immediately obvious benefit. Like, this class is super concise but it doesn't trade away any readability at all.

Having learned Ruby before Rails became commonplace, with its love for things that automagically work (until they don't), I had kinda grown to dislike it. But had forgotten how core Ruby is just an excellent programming language, regardless of what I think of the Rails ecosystem.

vault•2h ago
Like you, I remember 15 years ago when I decided to solve Project Euler in Ruby, a completely new language to me. I still remember the joy I was feeling when I started coding with this new language. So elegant! So natural! Like it was made to fit my brain. It's a pity I ended up working professionally with entirely different stuff.
js2•2h ago
Challenge accepted:

    from dataclasses import dataclass
    
    @dataclass(frozen=True, order=True)
    class AppVersion:
        major: int = 0
        minor: int = 0
        patch: int = 0
    
        @classmethod
        def from_string(cls, version_string: str):
            return cls(*[int(x) for x in version_string.split(".")])
    
        def __str__(self):
            return f"{self.major}.{self.minor}.{self.patch}"

Before dataclasses you could've used namedtuples, at a loss of attribute typing and default initializer:

    from collections import namedtuple
    
    class AppVersion(namedtuple("AppVersion", "major minor patch")):

        @classmethod
        def from_string(cls, version_string: str):
            parts = [int(x) for x in version_string.split(".")] + [0, 0]
            return cls(*parts[:3])
    
        def __str__(self):
            return f"{self.major}.{self.minor}.{self.patch}"
alberth•2h ago
Not knowing python, I find the data classes example extremely readable. More so than Ruby example.
disgruntledphd2•2h ago
I write mostly Python these days, but agree with op. The comparables implementation in Ruby seems much nicer to me (maybe because I'm less familiar with it).
js2•1h ago
It's virtually the same in Python if you wrote it explicitly:

    def <=>(other)
        [major, minor, patch] <=> [other.major, other.minor, other.patch]
    end
vs:

    def __lt__(self, other):
        return (self.major, self.minor, self.patch) < (other.major, other.minor, other.patch)
Then use the `total_ordering` decorator to provide the remaining rich comparison methods.

That said, it's a little annoying Python didn't keep __cmp__ around since there's no direct replacement that's just as succinct and what I did above is a slight fib: you still may need to add __eq__() as well.

jimbokun•1h ago
It's a little magicky. I guess the "Order=True" is what ensures the order of the parameters in the auto-generated constructor matches the order in which the instance variables are defined?
js2•1h ago
order: If true (the default is False), __lt__(), __le__(), __gt__(), and __ge__() methods will be generated. These compare the class as if it were a tuple of its fields, in order.

eq: If true (the default), an __eq__() method will be generated. This method compares the class as if it were a tuple of its fields, in order. Both instances in the comparison must be of the identical type.

jimbokun•1h ago
However, I think comparing the Ruby example implementation with the "data classes example" is a category error.

The Ruby example should be compared to the implementation of data classes. The Ruby code shows how cleanly the code for parsing, comparing and printing a version string can be. We would need to see the code underlying the data classes implementation to make a meaningful comparison.

pansa2•1h ago
You could also use a normal class, a direct translation of the Ruby example:

    @functools.total_ordering
    class AppVersion:
      def __init__(self, version_string):
        parts = [int(x) for x in str(version_string).split('.')]
        self.major, self.minor, self.patch = parts[0] or 0, parts[1] or 0, parts[2] or 0

      def __lt__(self, other):
        return [self.major, self.minor, self.patch] < [other.major, other.minor, other.patch]

      def __eq__(self, other):
        return [self.major, self.minor, self.patch] == [other.major, other.minor, other.patch]

      def __str__(self):
        return f'{self.major}.{self.minor}.{self.patch}'
sczi•39m ago
Nice solution with dataclass! And for a complete comparison with the blog you can also use a library to do it for you. It's not quite in the official python distribution but it's maintained by pypa as a dependency of pip so you probably have it installed already.

    >>> from packaging.version import Version
    >>> Version("1.2.3") > Version("1.2.2")
    True
    >>> Version("2.0") > Version("1.2.2")
    True
dlisboa•1h ago
Ruby trades away quite a few things for readability. It's beautiful but a lot is being hidden.

Some of those languages would have you deal with the problem of allocating multiple arrays in the heap just to compare three numbers. Or give you tools to outlaw passing invalid strings to AppVersion.new (quick: what is the comparison between AppVersions "foo" and "bar"?).

Plus you have very few tools to ensure code remains beautiful. I've worked with Ruby for close to two decades, almost nothing in the real world looks that clean. Take a look at the Gem::Version#<=> implementation that the article talks about: https://github.com/ruby/ruby/blob/master/lib/rubygems/versio...

jimbokun•1h ago
Wow I wonder why it's so verbose. Performance optimizations? Seems like this wouldn't be called often enough to show up in any performance profiling exercise.
dlisboa•1h ago
Ruby is very slow so you gotta squeeze everything you can everywhere. Even a seemingly simple method will have to be scrutinized so that overall performance isn't impacted. It's death by a thousand cuts.

See the commit that made it complex: https://github.com/ruby/ruby/commit/9b49ba5a68486e42afd83db4...

It claims 20-50% speedups in some cases.

There's churn that comes with that. Ruby will have code that is ever changing to gain 5%, 10% performance every now and then. You gotta put that on balance: in a language like Go this method would've been ugly from the start but no one would've needed to touch it in 100 years.

jfabre•25m ago
There are plenty of businesses that have under 10k users and can live perfectly well with http requests around 500-1000 ms. When there are performance issues, 95% of the times they come from the database, not the language.
dlisboa•8m ago
I somewhat agree. In general most apps are small where the language choice doesn’t really matter.

Caching is also vastly underutilized, most apps are read-heavy and could serve a significant portion of their requests from some form of caching.

> When there are performance issues, 95% of the times they come from the database, not the language.

Eh, statements like these are always too hand wavy. Resource usage has to do with performance, the DB has no fault in it but the runtime does.

Having worked with Rails a ton there’s a very large overhead, much more than 5%. Most apps would see a significant speed up if rewritten in a faster language, with no changes to the DB whatsoever. The amount of memory and CPU expended to the app servers is always significant, often outweighing the DB.

__jonas•1h ago
I don't really know Ruby, what is the to_s doing in

       parts = version_string.to_s.split(”.”).map(&:to_i)
Is it to_string? Isn't version_string already a string?
jimbokun•1h ago
Yes, to_s returns the string representation of an object.

I think it's a safety measure in case the argument passed in is not a string, but can be turned into a string. Safe to assume that calling "to_s" on a string just returns the string.

dlisboa•1h ago
Ruby is a dynamic language, `version_string` can be anything. The author uses `to_s` to coerce it into a string. There are problems with that: if I pass in an array it'll coerce into `"[1,2,3]".split(".").map(&:to_i)`, which makes no sense.
shevy-java•1h ago
One could do a conversion e. g.

    if x.is_a? Array
      x = x.first
Or something like that. Could be one line too:

    x = x.first if x.is_a? Array
dlisboa•1h ago
Most times it's better to just accept the dynamic nature of the language rather than do this kind of runtime type checking. You'd have to do this `.is_a?` dance for every type to have it be reliable.

Even if you implement an "interface" (duck typing) with `respond_to?(:to_app_version)` you still can't be sure that the return type of this `:to_app_version` is actually a string you can call `split()` on.

metalliqaz•1h ago
it allows you to initialize an AppVersion with an other AppVersion object
weaksauce•1h ago
it is a string usually but could be called with a single number or some other object that has that method overwritten and it would still do the right thing.
raincole•1h ago
It's trying to make it more 'type tolerant' so it accepts both string and int and perhaps other types that implement `to_s`.

It's also a quite bad practice to my eye.

iamjs•1h ago
it could be anything, but virtually everything implements `#to_s`.
shevy-java•1h ago
> But had forgotten how core Ruby is just an excellent programming language, regardless of what I think of the Rails ecosystem.

A problem is that ruby lost many developres; rails too but it is by far the biggest driver in ruby. And this creates problems, because it overshadows the remaining ruby developers.

joemasilotti•1h ago
> The author's AppVersion class is so nicely done, it's nuts how succinct eg the compare implementation is.

Why thank you! :D

_old_dude_•43m ago
Yes, the version in Java is clearly less elegant. Java has map+lambda and compareTo (<=>) but no tuple assignemnt and no splat.

    record AppVersion(int major, int minor, int patch) implements Comparable<AppVersion> {
      public static AppVersion of(String version) {
        var array = Arrays.copyOf(Arrays.stream(version.split("\\.")).mapToInt(Integer::parseInt).toArray(), 3);
        return new AppVersion(array[0], array[1], array[2]);
      }

      public int compareTo(AppVersion other) {
        return Comparator.comparingInt(AppVersion::major)
            .thenComparingInt(AppVersion::minor)
            .thenComparingInt(AppVersion::patch)
            .compare(this, other);
      }

      public String toString() {
        return "%d.%d.%d".formatted(major, minor, patch);
      }
    }
aldousd666•2h ago
I discovered this a few years ago when someone who didn't understand what semver is was trying to do a rails version upgrade for us. They were practically throwing stuff when I got there and explained that lexicographical comparison of the strings would not work. I was about to write my own class for it, but then I thought that since Bundler knew how to resolve deps we should see what it uses. The rest is history!
psadauskas•2h ago
I use it quite a bit when I have to monkeypatch a gem to backport a fix while I wait for a release:

    raise "check if monkeypatch in #{__FILE__} is still needed" if Gem::Version.new(Rails.version) >= Gem::Version.new("8.0.0")
This will blow up immediately when the gem gets upgraded, so we can see if we still need it, instead of it laying around in wait to cause a subtle bug in the future.
saghm•1h ago
> They were practically throwing stuff when I got there and explained that lexicographical comparison of the strings would not work.

Versions numbers can go to 10!?!

shevy-java•1h ago
> I discovered this a few years ago

Right. I think I found it on stackoverflow.

The question is: why does the official documentation not mention this, along with guides?

Answer: because documentation is something the ruby core team does not want to think about. It is using scary language after all: English. The bane of most japanese developers. Plus, it is well-documented in Japanese already ... :>

stefan_•23m ago
Aaand 10 years later you just learned to compare versions by equality instead of being impossibly clever.
parentheses•2h ago
I think this article is funny. Python's STL is way more useful and contains myriad useful things that Ruby lacks out of the box.

difflib is probably my favorite one to cite.

Go see for yourself: https://docs.python.org/3/library/index.html

The benefit there is that their quality, security, completeness and documentation are all great!

empiko•1h ago
If I would get a cent every time I solved a difficult problem in a project by pulling out difflib and shocking the team with it, I would have two cents. It's not a lot, but it's amusing that it happened two times already.
websitescenes•1h ago
Damn, I miss ruby and particularly Rails sooo much. I'm stuck rebuilding wheels in node currently :)
Bergrebell•1h ago
Going back to rails after all this JS years was the best decision we’ve ever made. Current state of rails is lit!
jaredcwhite•1h ago
Ruby is an awesome language. The first few 3.x releases brought incredible modern advancements, including pattern matching which I totally adore.

I'd love to see a lot more writing and advocacy around Ruby, and not Ruby/Rails. I don't use Ruby/Rails! I use Ruby. And I suspect a lot of folks who have left Ruby behind over the years might not realize some (many?) of their gripes are not with Ruby in general, but Rails in particular.

kazinator•1h ago
TXR Lisp:

  $ txr -i version.tl
  1> (equal (new (app-ver "1.2.003")) (new (app-ver "1.2.3")))
  t
  2> (equal (new (app-ver "1.2.003")) (new (app-ver "1.2.4")))
  nil
  3> (less (new (app-ver "1.2")) (new (app-ver "1.2.3")))
  t
  4> (greater (new (app-ver "1.2")) (new (app-ver "1.2.3")))
  nil
  5> (tostringp (new (app-ver "1.2.3.4")))
  "1.2.3.4"
  6> (tostring (new (app-ver "1.2.3.4")))
  "#S(app-ver str \"1.2.3.4\" vec (1 2 3 4))"
Code:

  (defstruct (app-ver str) ()
    str
    vec
    (:postinit (me)
      (set me.vec (flow me.str (spl ".") (mapcar int-str))))
    (:method equal (me) me.vec)
    (:method print (me stream pretty-p)
      (if pretty-p (put-string `@{me.vec "."}` stream) :)))