> Hi, I just happend to find out that the "elseif" in ruby
> is spelled as "elsif". Can anyone, probably Matz, tell me
> if there's any "historical" reason? :)
That was the thing I found most jarring about Ruby, too. Not being a
Perl programmer, “elsif” violated the principal of least surprise for
me. As I said in a post here a couple of months ago, I think it’s a
human factors issue. I understand all the Perl’ers and old Ruby hands
wanting to keep “elsif”, but since it doesn’t conflict with anything I
wish “elseif” would be added as an alternate syntax. After all,
there’s more than one way to do lots of other things in Ruby, and
that’s a good thing!
How about a vote? I vote to add elseif as an alternative… Least
Superise… I like it.
I don’t think that Ruby is a democracy.
Really, Matz is the creator of Ruby. It’s his choice.
(but if I were to vote, I’d vote “no”. I think that there is such thing
as too many ways to do it).
> Hi, I just happend to find out that the "elseif" in ruby
> is spelled as "elsif". Can anyone, probably Matz, tell me
> if there's any "historical" reason? :)
That was the thing I found most jarring about Ruby, too. Not being a
Perl programmer, “elsif” violated the principal of least surprise for
me. As I said in a post here a couple of months ago, I think it’s a
human factors issue. I understand all the Perl’ers and old Ruby hands
wanting to keep “elsif”, but since it doesn’t conflict with anything I
wish “elseif” would be added as an alternate syntax. After all,
there’s more than one way to do lots of other things in Ruby, and
that’s a good thing!
That’s what people suggested to me when I brought up the topic several
months ago. The problem is that then my code is not portable.
···
On Thursday 05 December 2002 16:21, Shannon Fang wrote:
How about a vote? I vote to add elseif as an
alternative… Least Superise… I like it.
Shannon
> Quicker than a vote: do it yourself for your personal
> installation of Ruby ;-)
> Edit the "keywords" file in the Ruby source, add the
> line:
> elseif, {kELSIF, kELSIF}, EXPR_BEG
> and recompile ruby. Needs gperf from gnu.org.
> Francois (who does prefer elsif !)
Seems like adding an ‘elseif’ alias is a simple and
forward-looking thing to do. Drop ‘elsif’ some day.
Can you imagine that there are people who love “elsif” and hate “elseif”?
And for them “Drop ‘elsif’ some day” would be as big of an issue as for
you having “elseif” (let alone compatibility).
···
----- Original Message -----
From: “Mike Hall” mghall@enteract.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, December 05, 2002 1:35 PM
Subject: Re: elseif?
And I don’t buy the premise that ‘elseif’ is harder than ‘elsif’.
They’re both pronounced “else if”, right?
Seems like adding an ‘elseif’ alias is a simple and
forward-looking thing to do. Drop ‘elsif’ some day.
So let see if I get this right…
People complain that they have to use ‘elsif’ and not ‘elseif’
Some one says something like “Seems like adding an ‘elseif’ alias is
a simple and forward-looking thing to do. Drop ‘elsif’ some day.”
An alias for ‘elseif’ is created
Later ‘elsif’ is dropped
People complain that they have to use ‘elseif’ and not ‘elsif’
Some one says something like “Seems like adding an ‘elsif’ alias is
a simple and forward-looking thing to do. Drop ‘elseif’ some day.”
An alias for ‘elsif’ is created
Later ‘elseif’ is dropped
Repeat until no one has the faintest idea what is going on
OR
Learn to type elsif (it is really quite trivial) or learn to use m4 or
write you own rubypp.
You realise of course that the existence ‘elseif’ will upset people just
as much as the non existence of ‘elseif’ upsets the others. You just
can’t win with situations like this. Children are notorious for whinging
if they dont get their way and equally for whinging if someone else gets
theirs.
elsif is a keyword, not a method…you cannot alias it…and I think
it’s a silly request to change it to elseif just because its “hard to
remember”. You have to learn every method name and function in Ruby to
use them, I would think learning the (limited) keywords would be simple.
Next someone is going to ask to change ‘case’ to ‘switch’
···
-----Original Message-----
From: Mike Campbell [mailto:michael_s_campbell@yahoo.com]
Sent: Thursday, December 05, 2002 4:39 PM
To: ruby-talk ML
Subject: Re: elseif?
Seems like adding an ‘elseif’ alias is a simple and forward-looking
thing to do. Drop ‘elsif’ some day.
People complain that they have to use ‘elsif’ and not ‘elseif’
Some one says something like “Seems like adding an ‘elseif’ alias is
a simple and forward-looking thing to do. Drop ‘elsif’ some day.”
An alias for ‘elseif’ is created
Everyone is happy! The end.
What bugs me is that ‘elsif’ is just garbage.
We don’t use “whl” for ‘while’ or “lup” for “loop” or “noo” for ‘new’,
or “yeeld”, “souper”, “kase”, “whyle”, “bgin”, “resque”, “brake”,
“retreye”, “raze”.
So why some half-bastardized word for ‘elseif’ or ‘elif’?
Just because perl has it.
Oh, ok.
Of the other scripting languages, what besides perl uses it?
Shell elif
Python elif (yes?)
Since Matz is the creator and his opinion is not to add elseif, I’d
rather say, we keep it like that. I agree with the view that alias is
not a good thing. Because it makes READING a program harder, when you
I first encounter do |var| … end, I didn’t realize {|var|… } is also
ok, but it seems straight forward…
The problem with elsif is that I think all major lanugages, C/C++ Pascal
Basic… are not using such strange thing. When I type in “else if” and
“elseif” in ruby, it doesn’t work… It makes learning a bit
not-so-straightforward…
I think for most people here, ruby is not the first lanugage, but ruby
is definitely among the best, if not THE best. As an incentive to learn
a second, third, fourth… lanugage, it must be easy to learn…
Tks.
Shannon
···
On Fri, 6 Dec 2002 06:57:04 +0900 “Rich Kilmer” rich@infoether.com wrote:
elsif is a keyword, not a method…you cannot alias it…and I think
it’s a silly request to change it to elseif just because its “hard to
remember”. You have to learn every method name and function in Ruby to
use them, I would think learning the (limited) keywords would be simple.
Next someone is going to ask to change ‘case’ to ‘switch’
People complain that they have to use ‘elsif’ and not ‘elseif’
Some one says something like “Seems like adding an ‘elseif’ alias is
a simple and forward-looking thing to do. Drop ‘elsif’ some day.”
An alias for ‘elseif’ is created
Everyone is happy! The end.
I believe, as I’m sure most others do, that keyword aliasing leads to madness.
Method aliasing is probably more evenly split, but even then we manage to get
productive work done for months on end without setting records for
longest-yet-most-pointless threads.
What bugs me is that ‘elsif’ is just garbage.
We don’t use “whl” for ‘while’ or “lup” for “loop” or “noo” for ‘new’,
or “yeeld”, “souper”, “kase”, “whyle”, “bgin”, “resque”, “brake”,
“retreye”, “raze”.
Because they all suck.
So why some half-bastardized word for ‘elseif’ or ‘elif’?
Just because perl has it.
Oh, ok.
What’s so good about ‘elif’? I’ll have you know that ‘elseif’ isn’t a word
either.
Of the other scripting languages, what besides perl uses it?
Shell elif
Python elif (yes?)
Tcl/Tk elseif and ‘else if’
Awk else if
Perl elsif
Ruby elsif
There, now it’s two each. Nature abhors asymmetry.
The problem with elsif is that I think all major lanugages, C/C++ Pascal
Basic… are not using such strange thing.
You should probably be careful using terms as ‘major languages’
(similarly ‘scripting languages’). After all, you’re suggesting that
Perl is not a major language =) Of course, once Ruby takes over the
world it’ll be a major language too.
When I type in “else if” and “elseif” in ruby, it doesn’t work… It
makes learning a bit not-so-straightforward…
After learning a few languages you become used to some things being
different. elif/elsif/‘else if’. do { } while() / loop … until ().
my/dim/type.
Ruby has its own special addons too. What other language has a return
value from its ‘if’ statement? It also as 0 being true. Where else is
that?
Thus sharing ‘elsif’ with at least one other language shouldn’t be that
much of a problem.
I think for most people here, ruby is not the first lanugage, but ruby
is definitely among the best, if not THE best. As an incentive to
learn a second, third, fourth… lanugage, it must be easy to learn…
I don’t know about you, but the more languages I learn, the more easily
I learn languages.
The only ones I’ve had trouble with are Java (due to having to navigate
that class library) and C++ (lack of effort mostly, and a vague fear of
the STL being like Java’s class library). The actual languages (without
libraries) I picked up quickly =)
Apologies if I come off a bit argumentative: I’ve been writing
argumentative things recently.
Since Matz is the creator and his opinion is not to add elseif, I’d
rather say, we keep it like that. I agree with the view that alias is
not a good thing. Because it makes READING a program harder, when you
I first encounter do |var| … end, I didn’t realize {|var|… } is also
ok, but it seems straight forward…
The problem with elsif is that I think all major lanugages, C/C++ Pascal
Basic… are not using such strange thing. When I type in “else if” and
“elseif” in ruby, it doesn’t work… It makes learning a bit
not-so-straightforward…
True, you can’t just type in C or Pascal keywords and expect them to
work in Ruby. Nor the other way around.
I think for most people here, ruby is not the first lanugage, but ruby
is definitely among the best, if not THE best. As an incentive to learn
a second, third, fourth… lanugage, it must be easy to learn…
I think many, many people have found Ruby to be almost uniquely
accessible and learnable among programming languages. I don’t know
what more you can ask from a language than that its learning curve be
what Ruby’s is. There would be no point in having a language where
you literally had to learn nothing new, since there would be nothing
new in it.
I’m not saying that the lack of ‘e’ in elsif is some kind of great
innovation. (Personally I can’t get worked up about it at all.) But
I do think it’s a bit ironic that Ruby, of all languages, should be
taken to task for not being straightforward to learn, when in fact the
evidence I’ve seen and heard suggests that it leads the pack in that
area.
The problem with elsif is that I think all major lanugages, C/C++ Pascal
Basic… are not using such strange thing. When I type in “else if” and
“elseif” in ruby, it doesn’t work… It makes learning a bit
not-so-straightforward…
…but only of you’re coming from a language that doesn’t have “elsif”. If
you come to ruby from a language that does or, even better, come to ruby
regardless of other languages (IOW, learn ruby, don’t learn how to do
language foo in ruby) it really shouldn’t be a problem.
I think for most people here, ruby is not the first lanugage, but ruby is
definitely among the best, if not THE best. As an incentive to learn a
second, third, fourth… lanugage, it must be easy to learn…
Alternatively some programmers try and learn other “first” languages, or
learn different languages because they are just that: different.