[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Small gripe about elsif...

Just Another Victim of the Ambient Morality

6/11/2006 9:00:00 PM

Why the keyword "elsif?" It looks so wrong... Specifically, for me, it
bears little resemblance to what it represents: "else if."
Now, looking at it from the other perspective, I understand why it
wasn't "elseif." It's a little awkward to have two vowels together like
that, especially if they're unrelated (from two seperate words). Ruby was,
also, very PERL-esque, which uses the same keyword and, perhaps, this is the
real reason it was used.
Would it have been too much to have "else_if" as a keyword? It's
perfectly clear and no more wordy than a lot of method names. I'm pretty
sure that Ruby has moved on from its PERL like origins so, at least, a
keyword addition shouldn't be so bad...
So, what do people think of "elsif" and "else_if?"
Thank you for your attention...


4 Answers

msoulier

6/12/2006 12:33:00 AM

0


Just Another Victim of the Ambient Morality wrote:
> Why the keyword "elsif?" It looks so wrong... Specifically, for me, it
> bears little resemblance to what it represents: "else if."

Something that Ruby inherited from Perl. I've found that language
designers can never agree on else if. I've seen

elseif
else if
elsif
elif

I mean...pick one.

Mike

Darwin

6/12/2006 5:14:00 AM

0

On Sun, 11 Jun 2006 20:59:32 GMT, Just Another Victim of the Ambient
Morality wrote:

> Why the keyword "elsif?" It looks so wrong... Specifically, for me, it
> bears little resemblance to what it represents: "else if."
> Now, looking at it from the other perspective, I understand why it
> wasn't "elseif." It's a little awkward to have two vowels together like
> that, especially if they're unrelated (from two seperate words). Ruby was,
> also, very PERL-esque, which uses the same keyword and, perhaps, this is the
> real reason it was used.
> Would it have been too much to have "else_if" as a keyword? It's
> perfectly clear and no more wordy than a lot of method names. I'm pretty
> sure that Ruby has moved on from its PERL like origins so, at least, a
> keyword addition shouldn't be so bad...
> So, what do people think of "elsif" and "else_if?"
> Thank you for your attention...

I prefer "elsif". Phonetically, "elsif" is identical to "else if". So
they have that in common. "else_if" requires two extra symbols and the
'_' requires that the shift key be pressed. I'm all for conciseness and
ease of typing.

jonT

6/12/2006 12:10:00 PM

0

Darwin wrote:
> On Sun, 11 Jun 2006 20:59:32 GMT, Just Another Victim of the Ambient
> > Why the keyword "elsif?" It looks so wrong... Specifically, for me, it
> > bears little resemblance to what it represents: "else if."

I've never found a use for the elsif construct. Typically (!) it's more
readable to use a case statement or nested if.

Just Another Victim of the Ambient Morality

6/12/2006 8:58:00 PM

0


"Darwin" <darwin@nospam.com> wrote in message
news:17u0imrlhasw$.dbxgq3hs5zou$.dlg@40tude.net...
>
> I prefer "elsif". Phonetically, "elsif" is identical to "else if". So
> they have that in common. "else_if" requires two extra symbols and the
> '_' requires that the shift key be pressed. I'm all for conciseness and
> ease of typing.

Yeah, I don't read phonetically or, at least, I try not to.
There's a balance to strike between concise and laconic. While one can
be too verbose, I think most of us find the opposite problem; variable
names, for example.
It's also the "Ruby way" to use underscores when seperating different
words, so I don't think ease of typing is a priority for Ruby. Besides, I
don't think enough programming time is spent actually typing to worry too
much about how easy something is to type...