4 ms·
I feel like you're placing way too much emphasis on syntax here. From a non-superficial standpoint, you haven't brought up a single thing wrong with Ruby— or G
by jeorgun 12y ago
I feel like you're placing way too much emphasis on syntax here.
From a non-superficial standpoint, you haven't brought up a single thing wrong with Ruby— or Go, aside from explicit typing.
The thing about syntax is that, to some extent, it's subjective. You say Ruby syntax is awful? OK. Personally, when I first started programming, I hated Python syntax¹ so much that I called it quits. It wasn't until later, when I started learning Ruby and its "eye-gouging" syntax, that I could get past that hurdle. So I wouldn't exactly describe its syntax as an argument against using Ruby as a teaching instrument.
¹I've since grown to love it, but as a beginner this was very much not the case.
- freyrs3 12y agoYes, it's pretty universal that people find it uncomfortable to force themselves to think in a language they don't fully understand yet. Whether that's Ruby, Haskell, or Japanese. There are plenty of valid things to compare languages on ( semantics, types, runtimes, etc ) but arguments about lexical syntax are really not that interesting since they're usually just throwing opinions back and forth about which lexical construct is more "readable", as if this term had some objective cross-language meaning.
- csense 12y agoSorry for the necro-reply, but here goes. There are two things about syntax that I think are actually objective. One is that, when beginners read their own source code that isn't working, they often have more of a tendency to read what they intended to write instead of what they actually wrote, especially when it comes to punctuation symbols. This means that, when the indentation is right, but there's a missing -- or extra -- brace or semicolon, it can be very, very difficult problem for a beginner to even see. It's also possible for a beginner to write a program with many instances of brace/semicolon issues, giving a frustrating (and sometimes bewildering) boatload of syntax errors. The second problem is that it's difficult to remember the meaning of symbols. This is true not just for beginners, but also for experts learning a new language with different symbols. This means that the number of symbols in a language should be kept to a minimum. Furthermore, where possible, symbols identical to those used in other languages, or in mathematics, should be used. Where a language has novel ideas that don't exist in other languages, those ideas should usually be expressed by keywords, not symbols. Ruby fails at this. See [1] for an example. I don't mean to pick on this particular project, rather this file is typical of Ruby code. The file contains the following symbols which seem to be used differently from any language I'm familiar with: Less-than sign used in class declaration, use of colons for thing(s) that are neither dictionary literals nor labels, "absolute value" bars in e.g. { |p| p.id }, shift-left operator used in class declaration, question mark used for something besides ternary operator, lines without side effects like "true" and "false" sprinkled throughout the code (is there some "empty operator" that's applied to these lines to give them side effects?). My point is that neither a beginner, nor an expert in non-Ruby languages, can understand the above code without constantly consulting the documentation for the unfamiliar syntax elements (and good luck figuring out how to search for "meaning of -> operator in Ruby" without knowing what the -> operator is actually called!) Whereas most Python programs read like pseudocode and can be reasonably well interpreted even by someone quite unfamiliar with the language. Good languages address that problem by limiting the number of symbols, and making the meaning of symbols as simple and intuitive as possible. Ruby fails utterly on both counts. I think these facts should be simple and obvious to anyone who's ever attempted to learn either Ruby or Python, but I guess this is HN, where an amazing number of people think Ruby is the bees' knees for no reason I can make sense of. [1] https://github.com/gitlabhq/gitlabhq/blob/2a8aa7429b6f489acd07c99e2e33a09c21c2ba01/app/models/users_project.rb https://github.com/gitlabhq/gitlabhq/blob/2a8aa7429b6f489acd...
- jeorgun 12y agoIf we're necro-replying… Thanks for the detailed reply. Those are all good points. It's worth pointing out that a lot of Ruby's oddities (specifically :symbols, predicate_functions?, and implicit returns) are stolen from various Lisp dialects— which is also true of a lot of significant semantic/cultural differences between Ruby and Python. So you could argue that the syntax differences are just a surface form of the underlying semantic differences. But that's kind of cheating (except for the implicit returns, which is a straight-up semantic difference). Maybe the better point to draw is that there is a background (Lisp) in which its syntactic quirks make sense. As an expert, the fact that that background is an unusual one is a negative for intuitiveness. But as a beginner, with no backing in Algolesque languages, does it really make that much of a difference? Of course, none of that gets into the plain syntactic quirks— ->(pointy){lambdas}, {|block|syntax}, and so forth. But every language¹ has some of those— good luck making sense of Python decorators when starting out, or for that matter list comprehensions. Or non-paren-enclosed-tuples. Ruby's are used more heavily, but that seems more like a cultural difference than a syntactic difference— generally Python favors readability ahead of 'elegance', and Ruby vice-versa, which extends to making heavier use of special syntactic forms. ¹Except Lisp dialects, ironically! But even there, `(there are ,still some . peculiarities).