Small gripe about elsif...

  • Thread starter Just Another Victim of the Ambient Morality
  • Start date
J

Just Another Victim of the Ambient Morality

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...
 
M

msoulier

Just said:
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
 
D

Darwin

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.
 
J

jonT

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

Just Another Victim of the Ambient Morality

Darwin said:
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top