4 ms·
It is mind-boggling to me to see all the low-value features that Ruby has, but no enums. So every time an enum is needed, there's some ugly code that tries to e
by chihuahua 3y ago
It is mind-boggling to me to see all the low-value features that Ruby has, but no enums. So every time an enum is needed, there's some ugly code that tries to emulate an enum.
The guiding theme for Ruby appears to be "let's give people a huge number of ways to write unreadable code" and it reminds me of JWZ's classic rant about PHP, "a fractal of bad design."
- jjgreen 3y agoI disagree, but thanks for reminding me of that article, just splendid https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ You couldn't really find that many quirks, edge-cases and foot-guns in Ruby, could you?
- chihuahua 3y agoFor me, it's not so much that there are quirks and edge-cases, but rather that Ruby seems to have a lot of clutter (e.g. "unless", punctuation as part of function names, etc) while useful features are missing.
- jjgreen 3y agoFair enough, a matter of taste. Personally I'm a fan of "then" which I guess would give you the horrors :-)
- sensanaty 3y agoI always find talking about Ruby fascinating, because it's so divisive and for good reason. It's one of those things where you either love it or hate it. The first moment I saw a question mark denoting a boolean, I fell in love with Ruby right then and there, but I also perfectly understand why people hate that. Same with stuff like `unless`, whenever I use a different language I'm always tempted to make a small utility class with all the Ruby niceties like `unless`, and that's another thing I can completely understand not liking.
- hu3 3y agoEven PHP has enums now and they are pretty cool: https://stitcher.io/blog/php-enums https://stitcher.io/blog/php-enums
- pvg 3y agoThat wasn't written by jwz.
- jes5199 3y agoI think the ruby answer is “just use symbols”
- oezi 3y agoAn array of symbols, yeah. What else do you need?
- amomchilov 3y agoExhaustivity checking.