[NCLUG] Looking at programming languages...

Bob Proulx bob at proulx.com
Thu Jan 17 22:15:13 MST 2008


Sean Reifschneider wrote:
> The biggest problem I had when learning Ruby was the lack of parens in the
> examples of function calls.  In Ruby you can leave out the parens if it's
> obvious what is what.  However, when I read these I always found that I
> would go "WTF?" and have to go through and figure out what it really meant.

I think that was influenced as a pendulum swing in the opposite
directly from perl.  Because most perl programs make use of every key
on the keyboard there was a desire in ruby to avoid the special
non-alphanumeric ones and use only the plain text characters.  I think
this is why rubyists make use of the list form more often than not.

In perl use of parens is also optional if prototypes are in scope and
it is not an indirect method call so this use in ruby is also an
inherited behavior from perl.  Specifically in object oriented perl
the use of $objref->method(@args) does not check prototypes.
Therefore the list form can't be used there.  The parens are required.

> Maybe that's just me, but I found that the lack of parens got quite in the
> way of trying to learn it by example.  This isn't really a language
> problem, except that the language allows it.  This is more a problem I had
> with the Ruby examples.

For what it is worth I prefer to see the parenthesis there as well.
It visually triggers my neurons to see the function call and arguments
much more clearly than without.  The push to avoid *all* special
characters takes this a little bit too far in my opinion.

However I have been going with the flow.  Since the community around
it has drifted toward avoiding using parenthesis when possible I have
been doing the same.  When in Rome...  I have mostly gotten used to
it.  I imagine that for the community that learned the "list form"
without parens (including the perl folks) that seeing a program with
all functions with parens looks very noisy to them and they have the
reverse reaction.

> Ruby, in general, I think is a good language.  If Python didn't exist, I'd
> almost certainly be using Ruby instead.

I have the same feeling about Python.  If Ruby did not exist I would
almost certainly be programming in Python.  :-)

Bob



More information about the NCLUG mailing list