3 ms·
While there are a couple of things in there that annoy me about Ruby, the list basically feels like a stereotypical American pointing at a stereotypical Frenchm
by rauljara 14y ago
While there are a couple of things in there that annoy me about Ruby, the list basically feels like a stereotypical American pointing at a stereotypical Frenchman and saying, "Look at that French guy. He looks funny."
Yes, different languages do things differently. I like discussions about the tradeoffs. I get a lot out of discussions like that.
But these WTF sort of lists are pretty worthless. The implicit argument is that OMG this language is broken. Yet for any major language, people have been able to build some pretty complicated stuff with it. Clearly all these WTF things are at the very least surmountable. And a lot of them stop seeming so WTF if you actually make some effort to think about or learn why they're there.
- vidarh 14y agoIf it had been a "Ruby WTF's" list, I wouldn't have had any issues with it. While many of those items are like that for good reasons, I'd understand them causing someone reasonably new to Ruby to get confused, and worth discussing. When it's called "Ruby mistakes" on the other hand, it just gets silly.
- navyrain 14y ago100% agree. Bashing on other languages, as the author has done, makes him look childish, but worse, does the community a disservice. Professionals should be able to articulate and compare the merits of the decisions made by different languages. Even when the talking about more subjective topics, like syntax aesthetics, we can do better than simply calling them "bizarre." These are learning opportunities, not reasons to ridicule "the other team".
- norswap 14y agoRuby is not a "broken" langage. I use it and like it. But yes those are WTF things, and you have to know what they are. I remember that upon encountering it I couldn't wrap my head around throw/catch and raise/rescue. "Surely it can't that bad" I told myself. It was. The same goes for the so-called "module system". Spitting on java is very hip, but its module system is way better than Ruby is. And to the other commenter, yes those are mistakes. Calling them mistakes does not imply that the langage is beyond hope or unusable.
- halostatue 14y agoI have absolutely no clue what you're talking about WRT throw/catch and raise/rescue being confusing and bad. It's not. They do different things and have different purposes. I can't think of any time that I have used throw/catch, but I absolutely know its purpose, and its parallel nature to exceptions make frameworks like Sinatra fairly elegant. Ruby also doesn't have a so-called "module system", so I have no clue what you or the OP are talking about. Both classes and modules in Ruby can be used for namespacing purposes. Modules tend to fill the default "pure namespace" role, but that isn't their purpose—it just happens to be convention. The purpose of a module is an interface (per Java) with implementation—a mixin. If, however, you're referring to the way that ruby programs are structured and how Kernel#require works…you're still barking up the wrong tree. Yes, Ruby has mistakes—these two items that you've mentioned are not. Neither are most of the things that the OP's gist mentions. Some things on the list are confusing (break/next/return semantics; Yehuda Katz has a good article highlighting it that I found after a discussion with Reg Braithwaite [raganwald] and others on Twitter that had started the night before at a bar); most of them are simply the author's ignorance—and I don't mean that disparagingly. I am ignorant of many things about Python and JavaScript, because they are not my primary programming languages. Ignorance can be easily cured. Arrogance is much harder to cure.
- norswap 14y agoBy "module system", I mean a way to handle namespacing. I checked a few facts out, and it's actually less bad than I thought. The main problem I see is that it doesn't warn you of collisions when including modules. But if you catch a collision yourself, you can resolve it. About throw/catch and raise/rescue. First, why have throw/catch and not have it do what it does in every single other langage? I guess this is debatable. Secondly, a problem with throw/catch is that there is no "clean" way to know if you exited via a throw or normally (the hackish way involves a boolean variable). I guess you could argue that it isn't the intended use. I'm missing this because of the following point. My real grief with raise/rescue is that it acts exactly like Java's throw/catch, while it could be so much more. Why couldn't we throw arbitrary objects? And pass arbitrary objects to rescue, which would have a special method (lets call it "catches?(e)") that would check if the objects "matches" a thing that was thrown. Exception classes would have this as a class method, and it would match its own instances. This, incidentally, is exactly how the ruby case statement works. In that case, the special method is "===". So that's an inconsistency in the langage right there I'd say. Or at the very least, a missed opportunity. So ok, maybe not "mistakes" if that's too strong of a word for you. But "things that should change"? Definitely. Also, ad hominems are lame.