by Tichy · 17y ago · 0 comments
For example, yesterday I caused an infinite loop in my Rails controller because I forgot the "@" in front of a variable that had the same name as the action - so Ruby interpreted it as a method call, not a variable reference. Being able to call methods without "()" is part of the Ruby-DSL stuff, but I wonder if typing "()" would not actually be the lesser pain in the end. I probably lose much more time to hunting such bugs than I lose time typing ().
To your main point, all general purpose languages are good enough at everything. That's how they get to be called "general purpose". But, I would argue that there are 0 languages that are great for everything. There is no language that can be shown to have 0 tradoffs when compared to all other languages.
The thing that often gets over-looked with Ruby is the trade off that many other languages make of developer time and enthusiasm (happiness, comfort, engagement, morale, etc). If you don't believe those factors exist or that they have little value then the trade off the language makes to afford those features is lost in translation.
To make a crude analogy: if I were hiring to get a company off the ground I would love to find a single person to do all of the product concepts, design, implementation, sales, accounting, legal work and support. The problem is that the jack of all trades is master of none and you're likely to get some creative concepting all over your accounting. Languages specialize in thousands of ways over the growth of the language (and hopefully consciously) - much like people do with education and career development. Even at times under the guise of general purposeness.
This is all to say that unfortunately your wanting a language that is great for everything is impossible. But, you might find a language that is good enough at all of the trade-offs you care about without ever trading off all the other things you care about and for all projects for all time.
Of course there are always tradeoffs, but some tradeoffs might not matter (that is, there might be no situations in which the tradeoffs would matter.)
I am not yet convinced that Ruby is so much more pleasant than other languages. I don't know Scala yet, but what if Scala is actually pleasant to use? Then Scala might be better than Ruby in every respect. (Not saying it is, I don't know Scala).
When people talk about power, elegance and abstraction of a language (not compiler, VM, libraries, etc) they are talking about the language platformed on the human brain (something unique to the individual). Ruby targets a certain brain platform while C targets a different one and Scala yet another. Twitter engineers sound like they have brains appropriate for both Ruby and Scala. Scala makes less technical trade-offs toward their end and so there arises a clear winner (for them).
The day we're all using the same brain platform then there could be argued to exist a best language.
I would say though that Ruby is a bit more complex of a language that people advertise. A novice will be bitten by these things, but someone who's worked with it full time for a couple weeks will not.
A language that excels at everything is an incoherent concept. There certainly are languages that are adequate at most things however.
It sounds like ruby did exactly what it should have done. There was a typo and you ended up calling a method. Even if ruby required parens for methods, you could have a typo missing the parens which would make it a local variable reference.
I would guess that a more common confusion with naked ruby methods is that they can be indistinguishable from local variables, and this isn't helped when people completely omit parens when passing params. This is why, despite some critisim of the practice, I pretty consistently use self and, when passing params, use parens.
If I mean instance variable, it is very unlikely that I would forget the @ in a language that always has an @ for instance variables. :-\
Maybe I'm missing something, but I don't see a fundamental distinction between the two purely on the basis of consistency. I think an argument could be made that the parens on a method are a more meaningful and representative syntax element than an @ on an instance variable, making it easier to remember. Then again, someone could argue that braces are a more meaningful syntax element than indentation, and we all know how that goes. :-)
And how about a pony while you are at it?;-) No language does everything, what you want to aim for is one that does as broad a range of things as possible:
http://journal.dedasys.com/2009/03/26/scalable-programming-l...
I think Ruby is 'pretty good' in those terms. Better than Java, IMO, because it lets me do small/quick things easily, something I've always found unpleasant in Java.