Elseif?

How about a vote? I vote to add elseif as an alternative… Least
Superise… I like it.

Shannon

···

From: paul@argelfraster.org (Paul J. Sanchez)
Reply-To: ruby-talk@ruby-lang.org
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: Re: elseif?
Date: Thu, 5 Dec 2002 14:53:08 +0900

> 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!

–paul


Protect your PC - get McAfee.com VirusScan Online
Antivirus, VPN, Identity & Privacy Protection | McAfee

Hi,

···

In message “Re: elseif?” on 02/12/05, “Shannon Fang” xrfang@hotmail.com writes:

How about a vote? I vote to add elseif as an alternative… Least
Superise… I like it.

But I will vote for “no”. I think this means something.

						matz.

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. :slight_smile:

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

Cheers,
Daniel.

···

Shannon

From: paul@argelfraster.org (Paul J. Sanchez)
Reply-To: ruby-talk@ruby-lang.org
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: Re: elseif?
Date: Thu, 5 Dec 2002 14:53:08 +0900

> 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!

–paul


Protect your PC - get McAfee.com VirusScan Online
Antivirus, VPN, Identity & Privacy Protection | McAfee

Shannon Fang wrote:

How about a vote? I vote to add elseif as an alternative… Least
Superise… I like it.

How about a vote to stop adding sugar. It rots the teeth.
(Says a man who is always caught out by PHPs use of elseif)

Quicker than a vote: do it yourself for your personal installation of Ruby :wink:

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 !)

···

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

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 !)

Daniel Carrera wrote:

I don’t think that Ruby is a democracy. :slight_smile:

And that’s a good thing.

(… I think that there is such thing
as too many ways to do it).

But we already have aliases all over the place in the classes
and libraries. Look at just the Array class:

collect!	map!
size		length
indices		indexes
slice		[ ]
to_ary		to_a

And one of them is just a change of spelling.

Seems like adding an ‘elseif’ alias is a simple and
forward-looking thing to do. Drop ‘elsif’ some day.

And I don’t buy the premise that ‘elseif’ is harder than ‘elsif’.
They’re both pronounced “else if”, right?

···


Mike Hall

Seems like adding an ‘elseif’ alias is a simple and
forward-looking thing to do. Drop ‘elsif’ some day.

Can you alias things other than methods?

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”?
:wink: 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?


Mike Hall

Mike Hall wrote:

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…

  1. People complain that they have to use ‘elsif’ and not ‘elseif’
  2. Some one says something like “Seems like adding an ‘elseif’ alias is
    a simple and forward-looking thing to do. Drop ‘elsif’ some day.”
  3. An alias for ‘elseif’ is created
  4. Later ‘elsif’ is dropped
  5. People complain that they have to use ‘elseif’ and not ‘elsif’
  6. Some one says something like “Seems like adding an ‘elsif’ alias is
    a simple and forward-looking thing to do. Drop ‘elseif’ some day.”
  7. An alias for ‘elsif’ is created
  8. Later ‘elseif’ is dropped
  9. 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.

Best not go there eh?

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’ :wink:

···

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

Can you alias things other than methods?

Mike Campbell wrote:

Can you alias things other than methods?

Just global variables, AFAIK:

irb(main):021:0> $foo = 7
7
irb(main):022:0> alias $bar $foo
nil
irb(main):023:0> $bar
7

Peter Hickman wrote:

  1. People complain that they have to use ‘elsif’ and not ‘elseif’
  2. Some one says something like “Seems like adding an ‘elseif’ alias is
    a simple and forward-looking thing to do. Drop ‘elsif’ some day.”
  3. An alias for ‘elseif’ is created
  1. 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?)

Tcl/Tk elseif and ‘else if’
Awk else if

Perl elsif

All right, all right, I’m done.

···


Mike

Mike Campbell wrote:

Can you alias things other than methods?

Just global variables, AFAIK:

irb(main):021:0> $foo = 7
7
irb(main):022:0> alias $bar $foo
nil
irb(main):023:0> $bar
7

Wow, and…well, pew.

Hi,

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’ :wink:

Peter Hickman wrote:

  1. People complain that they have to use ‘elsif’ and not ‘elseif’
  2. Some one says something like “Seems like adding an ‘elseif’ alias is
    a simple and forward-looking thing to do. Drop ‘elsif’ some day.”
  3. An alias for ‘elseif’ is created
  1. 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.

All right, all right, I’m done.

Let’s hope so.

Mike

Gavin

···

From: “Mike Hall” mghall@enteract.com

[…]

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.

cheers,

···


Iain.

Hi –

Hi,

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.

David

···

On Fri, 6 Dec 2002, Shannon Fang wrote:


David Alan Black
home: dblack@candle.superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav

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.

···


Dave Pearson
http://www.davep.org/

Ruby has its own special addons too. What other language has a return
value from its ‘if’ statement?

Algol68 … and I’d guess others it spawned, but, yes, it’s a little strange.

It also as 0 being true.

Yes, that one confused me, for a while!

H.

···

On Fri, 6 Dec 2002 10:13, Iain ‘Spoon’ Truskett wrote: