Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

elseif v. elsif ??

1 view
Skip to first unread message

7stud 7stud

unread,
Mar 7, 2007, 3:56:56 AM3/7/07
to
What the?? I just spent two days trying to figure out why I couldn't
reproduce the example in "Ruby in 20 minutes" and get it to work. After
examining my code line for line against the example code and not being
able to detect any error, I was assembling several code examples into a
text file to post here, when I happened to notice 'elsif'. Why
didn't Ruby flag 'elseif' as an error?


Does Ruby try differentiate itself in ridiculous ways like that just for
the sake of being different? And why isn't something like that
explicitly pointed out in a beginning tutorial? So far, I have to give
Ruby two thumbs down.

C++, Java, Javascript, php, Servlets+JSP programmer

--
Posted via http://www.ruby-forum.com/.

Chad Perrin

unread,
Mar 7, 2007, 4:00:11 AM3/7/07
to
On Wed, Mar 07, 2007 at 05:56:56PM +0900, 7stud 7stud wrote:
>
> Does Ruby try differentiate itself in ridiculous ways like that just for
> the sake of being different? And why isn't something like that
> explicitly pointed out in a beginning tutorial? So far, I have to give
> Ruby two thumbs down.

Ruby isn't the only language that does that.

"Different" would be more like the way bash does it: "elif"

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"There comes a time in the history of any project when it becomes necessary
to shoot the engineers and begin production." - MacUser, November 1990

Robert Dober

unread,
Mar 7, 2007, 4:03:54 AM3/7/07
to
On 3/7/07, 7stud 7stud <dol...@excite.com> wrote:
> What the?? I just spent two days trying to figure out why I couldn't
> reproduce the example in "Ruby in 20 minutes" and get it to work. After
> examining my code line for line against the example code and not being
> able to detect any error, I was assembling several code examples into a
> text file to post here, when I happened to notice 'elsif'. Why
> didn't Ruby flag 'elseif' as an error?
Because it nvere sees it :(

Look at two examples

if true then
whatever
elseif
end

now elsif is seen as an undefined method but

if false then
whatever
elseif
end

whatever and elseif are not evaluated.

I strongly advice you to use a syntax highlighting ediotr like e.g.
vim, emacs, Jedit, geany and tons of others.

Cheers
Robert


>
>
> Does Ruby try differentiate itself in ridiculous ways like that just for
> the sake of being different? And why isn't something like that
> explicitly pointed out in a beginning tutorial? So far, I have to give
> Ruby two thumbs down.
>
> C++, Java, Javascript, php, Servlets+JSP programmer
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous

Hans Sjunnesson

unread,
Mar 7, 2007, 4:19:34 AM3/7/07
to

Well, Ruby doesn't try to differentiate itself in ridiculous ways just
for the sake of being different. It's not a person.
However, it will spit out a "undefined method 'elseif' for main:Object
(NoMethodError)" when you use 'elseif', so it's really not a problem
is it?

--
Hans

Stefano Crocco

unread,
Mar 7, 2007, 4:36:20 AM3/7/07
to
Alle mercoledì 7 marzo 2007, Robert Dober ha scritto:
> if true then
>    whatever
>    elseif
> end
>
> now elsif is seen as an undefined method but

Not always. In Robert's first example,

> if true then
> whatever
> elseif
> end

you'll get a NameError (undefined local variable or method `elseif' for
main:Object (NameError))

In the following example, instead, you get a syntax error:

if x < 0 then puts "x<0"
elseif x < 3 then puts "0<=x<3"
else puts "x>=3"
end

The error message is:

syntax error, unexpected kTHEN, expecting kEND
elseif x < 3 then puts "0<=x<3"
^
Here, ruby doesn't complain because elseif doesn't exist, but because it finds
a 'then' where it shouldn't be (not following an if or elsif clause). By the
way, being a syntax error (it when the interpreter is parsing the file, not
when it executes it), this error is reported whatever the value of x is (and
even if x doesn't exist).

All these error messages aren't very easy to understand for a novice. To make
a comparison with other programming languages, I tried compiling a C program
with a similar mistake (in this case writing 'elseif' instead of 'else if').
The program was:

int main(){
int a=3;
int b=0;
if( a==4){ b=1;}
elseif(a==2){ b=2;} //should be else if
else{ b=3;}}
}

Compiling with gcc, the error message I got is:

test.c: In function 'main':
test.c:5: error: expected ';' before '{' token

As you can see, the error message doesn't speak of invalid keywords, but just
of a missing ;

Stefano

Robert Dober

unread,
Mar 7, 2007, 4:37:04 AM3/7/07
to
No of course it is not :)
I think to understand the frustration of OP however.
He is probably coming from a completely different world and it is not
always easy to grasp new concepts.
Therefore I preferred to ignore the aggressive nature of the post ;).
He might even have a point when he says that this is maybe not really
well documented, With this I do not mean the "elseif" of course but
just the dynamic evaluation of the code.

Maybe a chapter for that kind of pitfalls could be added somewhere -
well it probably is already, maybe somebody can indicate that.

This is however not a clearcut thing as it might seem at first view.

Robert

Chris Lowis

unread,
Mar 7, 2007, 4:59:17 AM3/7/07
to
> Maybe a chapter for that kind of pitfalls could be added somewhere -
> well it probably is already, maybe somebody can indicate that.

Perhaps at the "Ruby from other languages" page :
http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/

I find this page very helpful.

Regards,


Chris

Robert Dober

unread,
Mar 7, 2007, 5:29:48 AM3/7/07
to
On 3/7/07, Stefano Crocco <stefano...@alice.it> wrote:
<snip>

Good points Stefano, conclusion *always* use "then" :)

7stud 7stud

unread,
Mar 7, 2007, 5:54:15 AM3/7/07
to
Chris Lowis wrote:
>> Maybe a chapter for that kind of pitfalls could be added somewhere -
>> well it probably is already, maybe somebody can indicate that.
>
> Perhaps at the "Ruby from other languages" page :
> http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/
>
> I find this page very helpful.
>
> Regards,
>
>
> Chris


First, I'd like to say that the web site is really beautiful and eye
catching. There are some minor problems, for instance, the code
examples are in a small area width wise, so there is a horizontal scroll
bar that you need to scroll to the right to see the latter portion of a
line of code. However, the area with the code is very tall(more than
one screen), and it is very inconvenient to page all the way down to the
bottom in order to scroll to the right, and then go all the way back up
in order to read the code. Also, no matter how wide I make my browser
window(Safari 2.0.4), the area with the code does not expand
horizontally. It should expand horizontally as the browser window gets
wider, and the horizontal scroll bars should disappear.

If I run the following code, I don't get any errors:

class MegaGreeter
attr_accessor :names

#constructor
def initialize(names = "world")
@names = names
end

#functions:
def say_hi
if @names.nil?
puts "..."
elseif @names.respond_to?("each")
@names.each do |name|
puts "Hello #{name}!"
end
else
puts "Hello #{@names}!"
end
end
end
if __FILE__ == $0
mg = MegaGreeter.new(["Sally", "Jane", "Bob"])
mg.say_hi
end

7stud 7stud

unread,
Mar 7, 2007, 5:57:53 AM3/7/07
to
My output is:

~/2testing/dir1$ ruby rubyHelloWorld.rb
Hello SallyJaneBob!

ruby version:

~/2testing/dir1$ ruby -v
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]

Brian Candler

unread,
Mar 7, 2007, 6:01:42 AM3/7/07
to

That's because you're not exercising the section under @names.nil?

Try: mg = MegaGreeter.new(nil)

Robert Dober

unread,
Mar 7, 2007, 6:04:27 AM3/7/07
to
On 3/7/07, 7stud 7stud <dol...@excite.com> wrote:

I could explain why, but just follow Stefano's advice and put "then"
after each if elsif and elseif and you will see.

Robert Dober

unread,
Mar 7, 2007, 6:05:14 AM3/7/07
to
You spoiled it ;)
but this is a good way to explain it too...

7stud 7stud

unread,
Mar 7, 2007, 6:08:35 AM3/7/07
to
> Perhaps at the "Ruby from other languages" page :
> http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/

I did a search on the C/C++ page for 'elsif' and it wasn't found.

>Ruby isn't the only language that does that.
>"Different" would be more like the way bash does it: "elif"

To me 'elif' stands out like a red flag. 'elsif' is a more subtle
differentiation, and I couldn't spot it even though I had the problem
narrowed down to 3 lines of code. The "Ruby in 20 Minutes" tutorial is
obviously geared to the experienced programmer(beginner's don't know
what classes are or what an 'attr_accessor' is), so I would suggest
putting this in the tutorial:

LOOK AT THE ELSIF SYNTAX CAREFULLY--IT'S 'ELSIF' NOT 'ELSEIF'

with the 'E' in elseif in red.

Brian Candler

unread,
Mar 7, 2007, 6:10:29 AM3/7/07
to
On Wed, Mar 07, 2007 at 08:05:14PM +0900, Robert Dober wrote:
> >That's because you're not exercising the section under @names.nil?
> >
> >Try: mg = MegaGreeter.new(nil)
> >
> >
> You spoiled it ;)
> but this is a good way to explain it too...

and a good argument for code coverage testing (e.g. rcov)

7stud 7stud

unread,
Mar 7, 2007, 6:18:48 AM3/7/07
to
>That's because you're not exercising the section under @names.nil?
>Try: mg = MegaGreeter.new(nil)

>You spoiled it ;)
>but this is a good way to explain it too...

What does that have to do with anything?

>Good points Stefano, conclusion *always* use "then" :)

My first exposure to Ruby is the "Ruby in 20 Minutes" tutorial. If it's
good practice to always use 'then', how about putting it in the
tutorial?

7stud 7stud

unread,
Mar 7, 2007, 6:24:58 AM3/7/07
to
7stud 7stud wrote:
>>That's because you're not exercising the section under @names.nil?
>>Try: mg = MegaGreeter.new(nil)
>
>>You spoiled it ;)
>>but this is a good way to explain it too...
>
> What does that have to do with anything?
>

I tried it, and I got an error for the 'elseif'. Why is that? If the
first branch succeeds, why is the elsif branch even evaluated?

7stud 7stud

unread,
Mar 7, 2007, 6:28:43 AM3/7/07
to
7stud 7stud wrote:
> 7stud 7stud wrote:
>>>That's because you're not exercising the section under @names.nil?
>>>Try: mg = MegaGreeter.new(nil)
>>
>>>You spoiled it ;)
>>>but this is a good way to explain it too...
>>
>> What does that have to do with anything?
>>
>
> I tried it, and I got an error for the 'elseif'. Why is that? If the
> first branch succeeds, why is the elsif branch even evaluated?

Hmm...I think I get it: Ruby doesn't realize elseif is another branch,
it just thinks its the next statement after the if statement. But as
far as I know, all if statements are terminated with 'end'.

Brian Candler

unread,
Mar 7, 2007, 6:31:27 AM3/7/07
to
On Wed, Mar 07, 2007 at 08:28:43PM +0900, 7stud 7stud wrote:
> > I tried it, and I got an error for the 'elseif'. Why is that? If the
> > first branch succeeds, why is the elsif branch even evaluated?
>
> Hmm...I think I get it: Ruby doesn't realize elseif is another branch,
> it just thinks its the next statement after the if statement. But as
> far as I know, all if statements are terminated with 'end'.

And yours is.

Add some spaces at the front of the 'elseif' line, so that it aligns with
the 'puts "..."' on the line above. Then you'll see how Ruby is interpreting
your code.

Unlike python, Ruby doesn't *force* you to align your source in a particular
way.

7stud 7stud

unread,
Mar 7, 2007, 6:37:14 AM3/7/07
to
Another question. The tutorial says:

>Save this file as “ri20min.rb”, and run it as “ruby ri20min.rb”.

and at the top of the file is the shebang:

#!/usr/bin/env ruby

If you run the program using 'ruby filename', do you need the shebang?
I read something that said you only need the shebang if you want to
execute programs using just the filename, e.g.:

$ HelloWorld.rb

also what does 'env' do? I read the man pages on the env function, and
I can't figure out what it does in the shebang.

Pit Capitain

unread,
Mar 7, 2007, 6:40:31 AM3/7/07
to
7stud 7stud schrieb:
> (...)

> If I run the following code, I don't get any errors:
>
> class MegaGreeter
> attr_accessor :names
>
> #constructor
> def initialize(names = "world")
> @names = names
> end
>
> #functions:
> def say_hi
> if @names.nil?
> puts "..."
> elseif @names.respond_to?("each")
> @names.each do |name|
> puts "Hello #{name}!"
> end
> else
> puts "Hello #{@names}!"
> end
> end
> end
> if __FILE__ == $0
> mg = MegaGreeter.new(["Sally", "Jane", "Bob"])
> mg.say_hi
> end

Hi 7stud,

when reading (compiling) your code, Ruby can only detect syntactic
errors, and your code is syntactically correct. Other errors can only be
determined at run time. Let me show you...

You get an error when you try your code with another instance:

mg2 = MegaGreeter.new(nil)
mg2.say_hi

Output:

...
in `say_hi': undefined method `elseif' (NoMethodError)

This error message shows that Ruby tried to execute the method #elseif,
which obviously isn't defined. Ruby cannot decide in advance whether
there will be an error or not:

mg3 = MegaGreeter.new(nil)

def mg3.elseif(arg)
puts "Hello from elseif with arg #{arg}"
end

mg3.say_hi

This code defines the method #elseif for the object mg3. The output is:

...
Hello from elseif with arg false
in `say_hi': undefined method `each' for nil:NilClass (NoMethodError)

You can see that the #elseif method is called, but then there's an error
in the next line: because @names is nil in this case, we call the method
#each on the object nil, which isn't defined.

I should have said: normally it isn't defined. We can change this:

def nil.each
yield "nil"
end

mg3.say_hi

This code defines the method #each for the object nil, so that it passes
the string "nil" to the block. The output is:

...
Hello from elseif with arg true
Hello nil!

You can see that your code executes fine in this case. This can only be
determined by actually running the code. Ruby is very dynamic, which
sometimes isn't an advantage, as has been in your case. But it can be a
very powerful tool, which is why we all hang out here.

Regards,
Pit

7stud 7stud

unread,
Mar 7, 2007, 6:50:43 AM3/7/07
to
> Add some spaces at the front of the 'elseif' line, so that it aligns
> with
> the 'puts "..."' on the line above. Then you'll see how Ruby is
> interpreting
> your code.
>
> Unlike python, Ruby doesn't *force* you to align your source in a
> particular
> way.

Ok, thanks.

Robert Dober

unread,
Mar 7, 2007, 6:52:15 AM3/7/07
to
On 3/7/07, 7stud 7stud <dol...@excite.com> wrote:
> Another question. The tutorial says:
>
> >Save this file as "ri20min.rb", and run it as "ruby ri20min.rb".
>
> and at the top of the file is the shebang:
>
> #!/usr/bin/env ruby
>
> If you run the program using 'ruby filename', do you need the shebang?
That is correct

> I read something that said you only need the shebang if you want to
> execute programs using just the filename, e.g.:
>
> $ HelloWorld.rb
exactly

>
> also what does 'env' do? I read the man pages on the env function, and
> I can't figure out what it does in the shebang.
It runs a program in a modified environment, it is frequently used in
the shebang because it is normally in a standard location while ruby
itself might be in
different locations e.g. /usr/bin or /usr/local/bin.
It is a trick to get this information from the "environment".
But is is not always a good idea, try

#!/usr/bin/env ruby -w

it does not work -w is interpreted by env not by ruby :(


>
> --
> Posted via http://www.ruby-forum.com/.
>
>

Robert

7stud 7stud

unread,
Mar 7, 2007, 7:01:56 AM3/7/07
to
Thanks for all the help. It looks like way up at the top, Robert Dober
first identified the problem, but I didn't see how it applied.

As a newcomer, I would suggest someone redo the tutorial "Ruby in 20
Minutes": add in 'then' and include a statement about 'elsif v. elseif'.
I still think leaving the 'e' out is a ridiculous construct.

Pit Capitain

unread,
Mar 7, 2007, 7:23:26 AM3/7/07
to
7stud 7stud schrieb:

> I still think leaving the 'e' out is a ridiculous construct.

It all depends where you come from. Other languages have had elsif
before Ruby:

Ada
Perl
PL/SQL
PostgreSQL

Just to name a few.

Regards,
Pit

Chad Perrin

unread,
Mar 7, 2007, 7:28:51 AM3/7/07
to
On Wed, Mar 07, 2007 at 08:08:35PM +0900, 7stud 7stud wrote:
>
> To me 'elif' stands out like a red flag. 'elsif' is a more subtle
> differentiation, and I couldn't spot it even though I had the problem
> narrowed down to 3 lines of code. The "Ruby in 20 Minutes" tutorial is
> obviously geared to the experienced programmer(beginner's don't know
> what classes are or what an 'attr_accessor' is), so I would suggest
> putting this in the tutorial:
>
> LOOK AT THE ELSIF SYNTAX CAREFULLY--IT'S 'ELSIF' NOT 'ELSEIF'
>
> with the 'E' in elseif in red.

Really, your complaint amounts to nothing more than "I'm more used to
the way language A does it than the way language B does it -- so
language B must be wrong."

Technically speaking, "elseif", "elsif", and "elif" are equally "wrong".
To do it right, you'd have to make it "else if".

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

"It's just incredible that a trillion-synapse computer could actually
spend Saturday afternoon watching a football game." - Marvin Minsky

David A. Black

unread,
Mar 7, 2007, 8:17:48 AM3/7/07
to
Hi --

On 3/7/07, 7stud 7stud <dol...@excite.com> wrote:

> Does Ruby try differentiate itself in ridiculous ways like that just for
> the sake of being different?

No -- literally never.


David

--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

Robert Dober

unread,
Mar 7, 2007, 8:19:23 AM3/7/07
to
On 3/7/07, Chad Perrin <per...@apotheon.com> wrote:
> On Wed, Mar 07, 2007 at 08:08:35PM +0900, 7stud 7stud wrote:
> >
> > To me 'elif' stands out like a red flag. 'elsif' is a more subtle
> > differentiation, and I couldn't spot it even though I had the problem
> > narrowed down to 3 lines of code. The "Ruby in 20 Minutes" tutorial is
> > obviously geared to the experienced programmer(beginner's don't know
> > what classes are or what an 'attr_accessor' is), so I would suggest
> > putting this in the tutorial:
> >
> > LOOK AT THE ELSIF SYNTAX CAREFULLY--IT'S 'ELSIF' NOT 'ELSEIF'
> >
> > with the 'E' in elseif in red.
>
> Really, your complaint amounts to nothing more than "I'm more used to
> the way language A does it than the way language B does it -- so
> language B must be wrong."
>
> Technically speaking, "elseif", "elsif", and "elif" are equally "wrong".
> To do it right, you'd have to make it "else if".
Chad you remind me of a dispute between fans of Domingo and Pavarotti when
a spanish music magazin explained that such discussions are futile and
nobody can judge at that level. This explaination took a whole article
just in concluding that Carreras was better than both...

So why would "else if" be better?

Cheers
Robert


>
> --
> CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
> "It's just incredible that a trillion-synapse computer could actually
> spend Saturday afternoon watching a football game." - Marvin Minsky
>
>

Jenda Krynicky

unread,
Mar 7, 2007, 8:38:00 AM3/7/07
to
David A. Black wrote:
> Hi --
>
> On 3/7/07, 7stud 7stud <dol...@excite.com> wrote:
>
>> Does Ruby try differentiate itself in ridiculous ways like that just for
>> the sake of being different?
>
> No -- literally never.
>
>
> David

Yeah. Like the use of "throw" and "catch"; ".inject"; "yieieild" that's
not really the yield of coroutines, but just a way to call the unnamed
closure (or the unnamed unnamed function) that was passed to the method
as the last parameter; the fact that "and" and "or" have the same
precedence, while && has bigger precedence than ||, etc. etc. etc.

The fact that I'm supposed to write

puts 1 + 2 +
3

or

puts 1 + 2 \
+ 3

(Visual Basic anyone?) it fairly ... wuby as well.

7stud 7stud

unread,
Mar 7, 2007, 9:22:49 AM3/7/07
to
Chad Perrin wrote:
> On Wed, Mar 07, 2007 at 08:08:35PM +0900, 7stud 7stud wrote:
>> with the 'E' in elseif in red.
> Really, your complaint amounts to nothing more than "I'm more used to
> the way language A does it than the way language B does it -- so
> language B must be wrong."
>
> Technically speaking, "elseif", "elsif", and "elif" are equally "wrong".
> To do it right, you'd have to make it "else if".

Yes, I guess you're right. I've never seen 'elsif' or 'elif' before.
But couldn't/shouldn't that be expected? So why not point that out in
"Ruby in 20 Minutes"? There isn't even anything about that in the
"Ruby from C and C++" page either, although instead of burying it in
there, I suggest it be deployed to the front lines.

7stud 7stud

unread,
Mar 7, 2007, 9:24:29 AM3/7/07
to
Also, to be consistent, shouldn't it be:

z = if x < y
true
els
false
end

Martin DeMello

unread,
Mar 7, 2007, 9:35:41 AM3/7/07
to
On 3/7/07, 7stud 7stud <dol...@excite.com> wrote:
> Also, to be consistent, shouldn't it be:
>
> z = if x < y
> true
> els
> false
> end

Note the difference between

z = if x < y

-1
else if x == y
0
else if x < y
1
end
end
end

and

z = if x < y

-1
elsif x == y
0
elsif x < y
1
end

martin

7stud 7stud

unread,
Mar 7, 2007, 9:49:23 AM3/7/07
to
>I strongly advice you to use a syntax highlighting ediotr like e.g.
>vim, emacs, Jedit, geany and tons of others.

How do you turn on syntax highlighting with vim?

IM - Vi IMproved
~
~ version 6.2

Sebastian Hungerecker

unread,
Mar 7, 2007, 9:57:00 AM3/7/07
to
7stud 7stud wrote:
> How do you turn on syntax highlighting with vim?

:syntax on


--
Ist so, weil ist so
Bleibt so, weil war so

Robert Dober

unread,
Mar 7, 2007, 10:02:12 AM3/7/07
to

Thank you Martin, I started to feel lonely ;)
R

Avdi Grimm

unread,
Mar 7, 2007, 10:16:00 AM3/7/07
to
For the record, I find a few of Ruby's naming choices silly and
non-intuitive as well. "elsif", regardless of it's language lineage,
IS kinda weird and easy to miss. "case" should have been "switch".
And almost any of the proposed alternatives to "inject" would be
preferable - with my personal preferance being "fold".

But I'm so used to dealing with language eccentricities, and Ruby's
features give me so much joy, that it's easy to overlook such
nitpicks.

--
Avdi

John Joyce

unread,
Mar 7, 2007, 10:28:10 AM3/7/07
to
No.
Programming languages are, like all languages, arbitrary symbolic
sets based on some sort of logical meaning.
In this case, someone else's (els') logic.
Like human languages, it does little good to complain about idioms or
grammar, just use it.
Life is much easier then. Every programming language has differences,
sometimes small subtle ones. The small subtle things are what make C
and C++ difficult to debug. This is why we have tools like colored
text editors and lexical analyzers and debuggers. Arguably, a
computer language should be more like a human language, but that too
is a bad idea. Human language is very implicit, contextual, and
fuzzy. When you are really dealing with 1s and 0s you can't be so fuzzy.

Brian Adkins

unread,
Mar 7, 2007, 11:20:29 AM3/7/07
to
7stud 7stud wrote:
> What the?? I just spent two days trying to figure out why I couldn't
> reproduce the example in "Ruby in 20 minutes" and get it to work. After
> examining my code line for line against the example code and not being
> able to detect any error, I was assembling several code examples into a
> text file to post here, when I happened to notice 'elsif'. Why
> didn't Ruby flag 'elseif' as an error?

>
>
> Does Ruby try differentiate itself in ridiculous ways like that just for
> the sake of being different? And why isn't something like that
> explicitly pointed out in a beginning tutorial? So far, I have to give
> Ruby two thumbs down.
>
> C++, Java, Javascript, php, Servlets+JSP programmer
>

I have a similar language background (minus php). When I first looked at
Ruby, I spent a few minutes flipping through the Pickaxe, spotted what I
felt were some "Perlisms", and made a knee jerk reaction to reject the
language. I've since talked to a few folks who did the same, so mine was
not an isolated incident.

It was about a year later that I came back to Ruby (because of Rails)
and discovered that I like the language (a lot). I'm sharing this
because learning from other people's experience can be helpful. I don't
know if you'll end up enjoying the language as much as I have, but it
may be worthwhile to invest some more time with it before deciding. I
even realized that I actually like a few of the "Perlisms" - the horror! :)

7stud 7stud

unread,
Mar 7, 2007, 11:24:57 AM3/7/07
to
Sebastian Hungerecker wrote:
> 7stud 7stud wrote:
>> How do you turn on syntax highlighting with vim?
>
> :syntax on

Hey, I can see the elseif error now. :)

Jenda Krynicky

unread,
Mar 7, 2007, 11:45:25 AM3/7/07
to
Brian Adkins wrote:

> 7stud 7stud wrote:
>> explicitly pointed out in a beginning tutorial? So far, I have to give
>> Ruby two thumbs down.
>>
>> C++, Java, Javascript, php, Servlets+JSP programmer
>>
>
> I have a similar language background (minus php). When I first looked at
> Ruby, I spent a few minutes flipping through the Pickaxe, spotted what I
> felt were some "Perlisms", and made a knee jerk reaction to reject the
> language. I've since talked to a few folks who did the same, so mine was
> not an isolated incident.
>
> It was about a year later that I came back to Ruby (because of Rails)
> and discovered that I like the language (a lot). I'm sharing this
> because learning from other people's experience can be helpful. I don't
> know if you'll end up enjoying the language as much as I have, but it
> may be worthwhile to invest some more time with it before deciding. I
> even realized that I actually like a few of the "Perlisms" - the horror!
> :)

Don't worry. They'll go away. The Wuby moto is break what works, rename
what's commonly known and add gotchas for fun.

Jenda

Andrew Koenig

unread,
Mar 7, 2007, 12:11:43 PM3/7/07
to
"Chad Perrin" <per...@apotheon.com> wrote in message
news:20070307085...@apotheon.com...

> "Different" would be more like the way bash does it: "elif"

Different?

Algol 68 spelled it that way in 1967, a spelling that the Bourne Shell
adopted in Unix in 1977.


7stud 7stud

unread,
Mar 7, 2007, 1:50:17 PM3/7/07
to
> Don't worry. They'll go away. The Wuby moto is break what works, rename
> what's commonly known and add gotchas for fun.

I've seen it mentioned a couple of times--what the heck is wuby?

Austin Ziegler

unread,
Mar 7, 2007, 1:52:40 PM3/7/07
to
On 3/7/07, 7stud 7stud <dol...@excite.com> wrote:
> > Don't worry. They'll go away. The Wuby moto is break what works, rename
> > what's commonly known and add gotchas for fun.
> I've seen it mentioned a couple of times--what the heck is wuby?

Jenda, at least this version of Jenda since others seem to recognise
said person as a positive influence in the Perl world at one point, is
a troll.

There's absolutely nothing of value in what Jenda says at this point.

-austin
--
Austin Ziegler * halos...@gmail.com * http://www.halostatue.ca/
* aus...@halostatue.ca * http://www.halostatue.ca/feed/
* aus...@zieglers.ca

Lionel Bouton

unread,
Mar 7, 2007, 2:20:27 PM3/7/07
to
Austin Ziegler wrote the following on 07.03.2007 19:52 :
>
> There's absolutely nothing of value in what Jenda says at this point.
>

I don't agree. Thunderbird may be able to learn how to automatically put
trolls in my Junk folder thanks to him/her. Please continue Jenda, this
is a high trafic list, I need some material :-)

Lionel

Jacob Fugal

unread,
Mar 7, 2007, 3:50:58 PM3/7/07
to
On 3/7/07, Austin Ziegler <halos...@gmail.com> wrote:
> Jenda, at least this version of Jenda since others seem to recognise
> said person as a positive influence in the Perl world at one point, is
> a troll.


I agree with you insofar as "this version". I'm under the impression
that the posts are coming from someone posing as Jenda. It appears
that ruby-forum.com does send a activation email, but perhaps someone
hacked Jenda's email account or hacked the ruby-forum.com account post
activation. I just find it hard to believe that someone who'd been so
esteemed in the Perl community would stoop to the behavior we've seen
on this list, nor that they would refer to "Pearl"[1] in any forum...

Jacob Fugal

[1] ruby-talk:242290

Rimantas Liubertas

unread,
Mar 7, 2007, 3:56:09 PM3/7/07
to
> Yes, I guess you're right. I've never seen 'elsif' or 'elif' before.
> But couldn't/shouldn't that be expected? So why not point that out in
> "Ruby in 20 Minutes"? There isn't even anything about that in the
> "Ruby from C and C++" page either, although instead of burying it in
> there, I suggest it be deployed to the front lines.

I guess it will take a huge effort to document everything that may
be unfamiliar to one or another person coming from different background.
And "Ruby in 20 Minutes" will spend several hours just for those differences :)

Regards,
Rimantas
--
http://rimantas.com/

Robert Dober

unread,
Mar 7, 2007, 3:57:34 PM3/7/07
to
now that might be a stupid - although unlike - typo.
the behavior is strange though if the info concerning the person is
correct maybe I should search the archives.
Or maybe my first idea to contact CPAN is a good one too, imagine the
poor guy if his address is spoofed...

What'd you think?

Robert


>
> Jacob Fugal
>
> [1] ruby-talk:242290
>
>

Alex Young

unread,
Mar 7, 2007, 4:13:53 PM3/7/07
to
Robert Dober wrote:
> On 3/7/07, Jacob Fugal <luk...@gmail.com> wrote:
>> On 3/7/07, Austin Ziegler <halos...@gmail.com> wrote:
>> > Jenda, at least this version of Jenda since others seem to recognise
>> > said person as a positive influence in the Perl world at one point, is
>> > a troll.
>>
>>
>> I agree with you insofar as "this version". I'm under the impression
>> that the posts are coming from someone posing as Jenda. It appears
>> that ruby-forum.com does send a activation email, but perhaps someone
>> hacked Jenda's email account or hacked the ruby-forum.com account post
>> activation. I just find it hard to believe that someone who'd been so
>> esteemed in the Perl community would stoop to the behavior we've seen
>> on this list, nor that they would refer to "Pearl"[1] in any forum...
> now that might be a stupid - although unlike - typo.
> the behavior is strange though if the info concerning the person is
> correct maybe I should search the archives.
> Or maybe my first idea to contact CPAN is a good one too, imagine the
> poor guy if his address is spoofed...
>
> What'd you think?

Observe:

http://66.102.9.104/search?q=cache:xXEIdNOg_48J:www.perlmonks.org/%3Fnode_id%3D81566+jenda+ruby&hl=en&ct=clnk&cd=3&gl=uk&client=firefox-a

Not definitive, but certainly interesting. Also:

http://66.102.9.104/search?q=cache:95o0skP5sNAJ:www.perlmonks.org/%3Fnode_id%3D92976+jenda+ruby&hl=en&ct=clnk&cd=4&gl=uk&client=firefox-a

--
Alex

Robert Dober

unread,
Mar 7, 2007, 4:47:04 PM3/7/07
to
Oh boy I am a bad detective, I was about to innocent the guy.
You know I have not found a single reference to jenda <at> cpan <dot>
org he always uses is original address. http://search.cpan.org/~jenda/
He *always* signed his mails with a quote most of the time the same
from Terry Pratchett.
But I guess he just fell on his head, poor guy....

This does not concern me anymore.

Thx Alex I am grateful, was about to make a complete fool out of myself :(

Cheers
Robert

Michael P. Soulier

unread,
Mar 7, 2007, 9:42:11 PM3/7/07
to
On 08/03/07 Andrew Koenig said:

> Different?
>
> Algol 68 spelled it that way in 1967, a spelling that the Bourne Shell
> adopted in Unix in 1977.

Not to mention that Ruby builds on Perl, which uses elsif.

Mike
--
Michael P. Soulier <msou...@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

John Joyce

unread,
Mar 7, 2007, 10:30:41 PM3/7/07
to
Remember in those days, heck even in the 80's languages and tools
(programs) used the shortest names possible because computing power
and memory were at a premium so even saving one character made a
difference. Thus we get all these sick little names for Unix tools,
love them or hate them.

Chad Perrin

unread,
Mar 8, 2007, 1:00:36 AM3/8/07
to
On Wed, Mar 07, 2007 at 10:19:23PM +0900, Robert Dober wrote:
> On 3/7/07, Chad Perrin <per...@apotheon.com> wrote:
> >On Wed, Mar 07, 2007 at 08:08:35PM +0900, 7stud 7stud wrote:
> >>
> >> To me 'elif' stands out like a red flag. 'elsif' is a more subtle
> >> differentiation, and I couldn't spot it even though I had the problem
> >> narrowed down to 3 lines of code. The "Ruby in 20 Minutes" tutorial is
> >> obviously geared to the experienced programmer(beginner's don't know
> >> what classes are or what an 'attr_accessor' is), so I would suggest
> >> putting this in the tutorial:
> >>
> >> LOOK AT THE ELSIF SYNTAX CAREFULLY--IT'S 'ELSIF' NOT 'ELSEIF'
> >>
> >> with the 'E' in elseif in red.
> >
> >Really, your complaint amounts to nothing more than "I'm more used to
> >the way language A does it than the way language B does it -- so
> >language B must be wrong."
> >
> >Technically speaking, "elseif", "elsif", and "elif" are equally "wrong".
> >To do it right, you'd have to make it "else if".
> Chad you remind me of a dispute between fans of Domingo and Pavarotti when
> a spanish music magazin explained that such discussions are futile and
> nobody can judge at that level. This explaination took a whole article
> just in concluding that Carreras was better than both...
>
> So why would "else if" be better?

It's grammatically correct.

That was my point -- if you want to complain about one approach being
"more wrong" than another, the only one of the four that has any real
claim to correctness the others do not is the two-word version, because
it at least is grammatically correct English.

Of course, I don't much care. I'm perfectly willing to use elseif,
elsif, or elif, depending on the language. They all work. Bully for
them.

My point is not that everyone should start using "else if", but that
complaining that "elsif" is somehow "wronger" than "elseif" is silly.
You could as easily construct an argument the other way around. Watch
this:

elseif is more correct because "else" has an E in it!

elsif is more correct because it lends to correct pronunciation, while
elseif looks like it should be pronounced "ell-safe"!

Both are silly, all things considered. Both approaches are "incorrect"
by the grammatical rules of English.

Of course, in Ruby and Perl "elsif" is grammatically correct, and in VB
"elseif" is grammatically correct, while in Python and bash "elif" is
grammatically correct. These are not English. They're bash, Perl,
Python, Ruby, and Visual Basic, respectively. So, really, none of them
are incorrect.

Someone remind me, by the way, what non-MS languages use "elseif". I
know there are others, but I'm drawing a blank. Surely there must be
some language outside of Microsoft's miniature little ecosystem that use
elseif.

Oh, I just remembered PHP. Well, there you go. VB and PHP. Now all
three versions have two languages associated with them in this email.

I wonder if it's indicative of something fundamental that the two
languages out of the six that I'd be least likely to choose for serious,
large-scale development are the two languages that came to mind for
"elseif" examples. It's probably only indicative of my taste, I guess.

Chad Perrin

unread,
Mar 8, 2007, 1:02:18 AM3/8/07
to
On Thu, Mar 08, 2007 at 08:35:09AM +0900, Lloyd Zusman wrote:
> "Robert Dober" <robert...@gmail.com> writes:
>
> > On 3/7/07, Chad Perrin <per...@apotheon.com> wrote:
> >>
> >> [ ... ]

> >>
> >> Technically speaking, "elseif", "elsif", and "elif" are equally "wrong".
> >> To do it right, you'd have to make it "else if".
> > Chad you remind me of a dispute between fans of Domingo and Pavarotti when
> > a spanish music magazin explained that such discussions are futile and
> > nobody can judge at that level. This explaination took a whole article
> > just in concluding that Carreras was better than both...
> >
> > So why would "else if" be better?
>
> You're all wrong. The best is indisputably this:
>
> si ... , entonces
> ...
> si no y si ... , entonces
> ...
> si no y si ... , entonces
> ...
> si no,
> ...
> el fin

Maybe we should start using Japanese, particularly for Ruby.
Unfortunately, while I know enough nihongo to say "yes" and "no", I
don't know enough for "if" and "else".

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Amazon.com interview candidate: "When C++ is your
hammer, everything starts to look like your thumb."

Chad Perrin

unread,
Mar 8, 2007, 1:07:39 AM3/8/07
to

Whitespace isn't significant. No need to make it ugly like that.

. . though I understand your point -- that it's logically nested.
Then again, that's kinda what's happening anyway -- you're nesting "if"
inside "else". The use if elsif is just a linguistic convention that
some people find more helpful for understanding what's going on.

I suspect (though I don't know for sure, since I've never fully specced
out a language and implemented it) that using "else if" would even be
easier for the implementation, since there's one fewer keyword involved.
You'd just have to be sure to allow a "hidden" end keyword effect when
another else appears without an explicit end keyword.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Leon Festinger: "A man with a conviction is a hard man to change. Tell
him you disagree and he turns away. Show him facts and figures and he
questions your sources. Appeal to logic and he fails to see your point."

Chad Perrin

unread,
Mar 8, 2007, 1:10:07 AM3/8/07
to
On Thu, Mar 08, 2007 at 12:28:10AM +0900, John Joyce wrote:
> No.
> Programming languages are, like all languages, arbitrary symbolic
> sets based on some sort of logical meaning.
> In this case, someone else's (els') logic.
> Like human languages, it does little good to complain about idioms or
> grammar, just use it.
> Life is much easier then. Every programming language has differences,
> sometimes small subtle ones. The small subtle things are what make C
> and C++ difficult to debug. This is why we have tools like colored
> text editors and lexical analyzers and debuggers. Arguably, a
> computer language should be more like a human language, but that too
> is a bad idea. Human language is very implicit, contextual, and
> fuzzy. When you are really dealing with 1s and 0s you can't be so fuzzy.

I mostly agree -- except that complaints about syntax and the like that,
if addressed, would provide some measurable benefit for programmers
without notable detriment are certainly worth discussion. I just don't
think "elseif" vs. "elsif" meets such criteria for dicussion.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

"The first rule of magic is simple. Don't waste your time waving your
hands and hopping when a rock or a club will do." - McCloctnick the Lucid

Chad Perrin

unread,
Mar 8, 2007, 1:14:36 AM3/8/07
to
On Thu, Mar 08, 2007 at 03:50:17AM +0900, 7stud 7stud wrote:
> > Don't worry. They'll go away. The Wuby moto is break what works, rename
> > what's commonly known and add gotchas for fun.
>
> I've seen it mentioned a couple of times--what the heck is wuby?

It's a sarcastic, trollish way of saying "Ruby" if you're trying to
convey a sense that it is childish. The only person I've ever seen use
that spelling is "Jenda", and it's already getting old. If you're going
to choose to avoid Ruby, please don't do so because of what a troll
said.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

"There comes a time in the history of any project when it becomes necessary
to shoot the engineers and begin production." - MacUser, November 1990

Chad Perrin

unread,
Mar 8, 2007, 1:15:15 AM3/8/07
to

Ahh, the silver lining.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Chad Perrin

unread,
Mar 8, 2007, 1:21:30 AM3/8/07
to

That almost makes me embarrassed to be a Perl hacker on ruby-talk.

We're not all like that. In fact, that's a distinct rarity. So sad
that it's in someone well known that you get to see this nonsense.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

"The measure on a man's real character is what he would do
if he knew he would never be found out." - Thomas McCauley

Chad Perrin

unread,
Mar 8, 2007, 1:23:24 AM3/8/07
to

I was being slightly facetious. I really don't see anything
particularly wrong with any of these variations that have been discussed
here.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

print substr("Just another Perl hacker", 0, -2);

Yukihiro Matsumoto

unread,
Mar 8, 2007, 1:54:10 AM3/8/07
to
Hi,

In message "Re: elseif v. elsif ??"


on Thu, 8 Mar 2007 15:00:36 +0900, Chad Perrin <per...@apotheon.com> writes:

| elseif is more correct because "else" has an E in it!
|
| elsif is more correct because it lends to correct pronunciation, while
| elseif looks like it should be pronounced "ell-safe"!
|
|Both are silly, all things considered. Both approaches are "incorrect"
|by the grammatical rules of English.

Correct or not, I chose 'elsif' as the shortest correct pronounceable
word for 'else if'.

matz.

Chad Perrin

unread,
Mar 8, 2007, 2:28:44 AM3/8/07
to

. . and I'm perfectly happy with that choice. I'm sure I'd be happy
with the choice of "elseif", as well, except that I'd be slightly more
likely to introduce typos since I use elsif in Perl a lot more often
than I use elseif in PHP.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Robert Dober

unread,
Mar 8, 2007, 2:32:31 AM3/8/07
to
On 3/7/07, Lloyd Zusman <l...@asfast.com> wrote:
> "Robert Dober" <robert...@gmail.com> writes:
>
> > On 3/7/07, Chad Perrin <per...@apotheon.com> wrote:
> >>
> >> [ ... ]
> >>
> >> Technically speaking, "elseif", "elsif", and "elif" are equally "wrong".
> >> To do it right, you'd have to make it "else if".
> > Chad you remind me of a dispute between fans of Domingo and Pavarotti when
> > a spanish music magazin explained that such discussions are futile and
> > nobody can judge at that level. This explaination took a whole article
> > just in concluding that Carreras was better than both...
> >
> > So why would "else if" be better?
>
> You're all wrong. The best is indisputably this:
>
> si ... , entonces
> ...
> si no y si ... , entonces
> ...
> si no y si ... , entonces
> ...
> si no,
> ...
> el fin
>
>
> :) <== obligatory irony indicator
>
>
With all due respect Sir, you have forgetten

si puede ser

Cheers
Robert
>
> --
> Lloyd Zusman
> l...@asfast.com
> God bless you.

John Joyce

unread,
Mar 8, 2007, 2:34:21 AM3/8/07
to
be glad Mr. M didn't choose to make elsif in Japanese.
It's nothing like the English. But the way Ruby methods work by being
appended to an object does work like a lot of Japanese grammatical
endings (sans the dot of course). I can't say for sure that it has
anything to do with that choice of syntax, but it may explain why
Ruby is popular in Japan. Many structures in Japanese language are
similar to functions but the parameter list comes before the
function. Learning Japanese certainly wouldn't hurt understanding
most programming languages.

Chad Perrin

unread,
Mar 8, 2007, 5:38:45 AM3/8/07
to

I suspect the early popularity of Ruby in Japan had more to do with the
fact that it started there -- and the current popularity of Ruby in the
States has something to do with the fact that it finally spread far
enough to get noticed here.

In other words, its popularity in a given area probably relates to the
fact that it has finally been noticed there. It doesn't seem to take
much to make Ruby popular. You'd have a harder time *stopping* it from
being popular.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Jenda Krynicky

unread,
Mar 8, 2007, 6:49:00 AM3/8/07
to
Chad Perrin wrote:
> On Thu, Mar 08, 2007 at 06:13:53AM +0900, Alex Young wrote:
>> >>that ruby-forum.com does send a activation email, but perhaps someone
>> >What'd you think?
>>
>> Observe:
>>
>> http://66.102.9.104/search?q=cache:xXEIdNOg_48J:www.perlmonks.org/%3Fnode_id%3D81566+jenda+ruby&hl=en&ct=clnk&cd=3&gl=uk&client=firefox-a
>>
>> Not definitive, but certainly interesting. Also:
>>
>> http://66.102.9.104/search?q=cache:95o0skP5sNAJ:www.perlmonks.org/%3Fnode_id%3D92976+jenda+ruby&hl=en&ct=clnk&cd=4&gl=uk&client=firefox-a
>
> That almost makes me embarrassed to be a Perl hacker on ruby-talk.
>
> We're not all like that. In fact, that's a distinct rarity. So sad
> that it's in someone well known that you get to see this nonsense.

Well this is what you get if you force an already angry person to learn
a butt ugly language because some managor never heard of anything other
than ASP.Net, Java and Ruby on Rails. And decided (under these
conditions correctly) that the best option is RoR.

And no matter what you say treating newline as a statement terminator IS
plain stupid. Especially since the Ruby parser is not bright enough to
handle

foo.bar( 1 + 2
+ 3
)

Well, at least it breaks noisily in this case.

And while this is just a syntactic issue that I will most likely end up
learning to accept, the absence of use strict and even the total
unability to specify that I DO want a new variable is something I will
hate till the Ruby community gets through the flaming discussion that
the Perl one had some eight years ago.

Let's see ... what does this code do?

for my $obj (@list) {
$obj->foo()
}

Well, that's clear, it calls the foo() method on all objects in the
@list. OTOH, what does this one do?

list.each { |obj| obj.foo() }

Well, maybe it does the exact some thing ... and maybe it also changes
the obj variable from whatever it was before this line to the last
object in the list. How do you make it clear? Well, you don't. There's
no way to make sure variables do not leak out of blocks. Yeah, most
methods are 5 lines long so it doesn't matter, sure :-}

Jenda
P.S.: To make it "on topic". I don't care whether it's "elseif" or
"elsif". Whatever it is, the docs should state that clearly to alert the
people comming from any of the many languages that chose the other form.

Marc Heiler

unread,
Mar 8, 2007, 7:10:19 AM3/8/07
to
"The "Ruby in 20 Minutes" tutorial is obviously geared to the
experienced programmer"

Everyone should start with the pickaxe2, really. Or Pine tutorial. ;-)

Brian Candler

unread,
Mar 8, 2007, 7:32:05 AM3/8/07
to
On Thu, Mar 08, 2007 at 08:49:00PM +0900, Jenda Krynicky wrote:
> Let's see ... what does this code do?
>
> for my $obj (@list) {
> $obj->foo()
> }
>
> Well, that's clear, it calls the foo() method on all objects in the
> @list. OTOH, what does this one do?
>
> list.each { |obj| obj.foo() }
>
> Well, maybe it does the exact some thing ... and maybe it also changes
> the obj variable from whatever it was before this line to the last
> object in the list.

FWIW, I understand this is/has changed in ruby 1.9, so that block
parameters are always local to the block.

Daniel Berger

unread,
Mar 8, 2007, 7:33:29 AM3/8/07
to
On Mar 7, 11:14 pm, Chad Perrin <per...@apotheon.com> wrote:
> On Thu, Mar 08, 2007 at 03:50:17AM +0900, 7stud 7stud wrote:
> > > Don't worry. They'll go away. The Wuby moto is break what works, rename
> > > what's commonly known and add gotchas for fun.
>
> > I've seen it mentioned a couple of times--what the heck is wuby?
>
> It's a sarcastic, trollish way of saying "Ruby" if you're trying to
> convey a sense that it is childish.

Damn, it's also the name of my top secret fork of Ruby for MS Windows.
Windows + Ruby = Wuby. :)

I'm dwivin' in my car...

Dan

Robert Dober

unread,
Mar 8, 2007, 7:48:49 AM3/8/07
to
Cheer up you can still call it Microruby ;)
R

Alex Young

unread,
Mar 8, 2007, 8:55:48 AM3/8/07
to
Jenda Krynicky wrote:
> Chad Perrin wrote:
>> On Thu, Mar 08, 2007 at 06:13:53AM +0900, Alex Young wrote:
>>>>> that ruby-forum.com does send a activation email, but perhaps someone
>>>> What'd you think?
>>> Observe:
>>>
>>> http://66.102.9.104/search?q=cache:xXEIdNOg_48J:www.perlmonks.org/%3Fnode_id%3D81566+jenda+ruby&hl=en&ct=clnk&cd=3&gl=uk&client=firefox-a
>>>
>>> Not definitive, but certainly interesting. Also:
>>>
>>> http://66.102.9.104/search?q=cache:95o0skP5sNAJ:www.perlmonks.org/%3Fnode_id%3D92976+jenda+ruby&hl=en&ct=clnk&cd=4&gl=uk&client=firefox-a
>> That almost makes me embarrassed to be a Perl hacker on ruby-talk.
>>
>> We're not all like that. In fact, that's a distinct rarity. So sad
>> that it's in someone well known that you get to see this nonsense.
>
> Well this is what you get if you force an already angry person to learn
> a butt ugly language because some managor never heard of anything other
> than ASP.Net, Java and Ruby on Rails. And decided (under these
> conditions correctly) that the best option is RoR.
So you've been tasked by your superiors to learn a new language, and
your first interaction with the people who can best help you do that is
to antagonise them?

> And no matter what you say treating newline as a statement terminator IS
> plain stupid. Especially since the Ruby parser is not bright enough to
> handle
>
> foo.bar( 1 + 2
> + 3
> )
>
> Well, at least it breaks noisily in this case.
>
> And while this is just a syntactic issue that I will most likely end up
> learning to accept, the absence of use strict and even the total
> unability to specify that I DO want a new variable is something I will
> hate till the Ruby community gets through the flaming discussion that
> the Perl one had some eight years ago.

Please accept the simple fact that Ruby is not Perl, will not become
Perl, and does not need to be Perl. You will find that we are quite
willing to help with any problems you may have (at least, those of us
who haven't killfiled you already), but it is exceedingly unlikely that
any complaints you make about the language itself will be taken
seriously until you have enough experience with it to understand why it
is the way it is, and to analyse it on its own merits as opposed to
measuring it against an arbitrary external yardstick.

You are not the first person to make these complaints - although I've
never seen them made in such a mean-spirited, arrogant manner - and you
probably won't be the last. Somehow, in spite of the issues you've
identified, some of us manage to get useful, profitable work done. It
might be worth your while investigating how that's possible.

This is all I'm going to say on the matter. I presume everyone else is
following a "don't feed the trolls" policy - I guess I'm a little too
generous for that.

--
Alex

Chad Perrin

unread,
Mar 8, 2007, 1:07:08 PM3/8/07
to
On Thu, Mar 08, 2007 at 09:10:19PM +0900, Marc Heiler wrote:
> "The "Ruby in 20 Minutes" tutorial is obviously geared to the
> experienced programmer"
>
> Everyone should start with the pickaxe2, really. Or Pine tutorial. ;-)

The Pickaxe has some severe shortcomings as an instructional text for
people who are not experienced programmers. It's a great book in many
ways, but for a newbie programmer, not so much. It assumes a fair bit
of foreknowledge.

I'm glad Messrs. Thomas and Hunt didn't decide to try to make the
Pickaxe everything to everyone. Books that result from such an attempt
tend to be notoriously bad at being anything to anyone. Pick a target
audience for your book, and stick to it -- you'll have better luck that
way. The Pickaxe is great within its niche. Just don't make the
mistake of thinking that niche is for people who are new to programming.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Chad Perrin

unread,
Mar 8, 2007, 1:10:10 PM3/8/07
to

Hey . . . if you were really planning a "top secret fork of Ruby for MS
Windows", I'd say Wuby would be an *excellent* name for the language.
One wonders, however, why you'd need to fork it for Windows.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Chad Perrin

unread,
Mar 8, 2007, 1:11:03 PM3/8/07
to
On Thu, Mar 08, 2007 at 09:48:49PM +0900, Robert Dober wrote:
> On 3/8/07, Daniel Berger <djbe...@gmail.com> wrote:
> >On Mar 7, 11:14 pm, Chad Perrin <per...@apotheon.com> wrote:
> >> On Thu, Mar 08, 2007 at 03:50:17AM +0900, 7stud 7stud wrote:
> >> > > Don't worry. They'll go away. The Wuby moto is break what works,
> >rename
> >> > > what's commonly known and add gotchas for fun.
> >>
> >> > I've seen it mentioned a couple of times--what the heck is wuby?
> >>
> >> It's a sarcastic, trollish way of saying "Ruby" if you're trying to
> >> convey a sense that it is childish.
> >
> >Damn, it's also the name of my top secret fork of Ruby for MS Windows.
> >Windows + Ruby = Wuby. :)
> >
> >I'm dwivin' in my car...
> >
> Cheer up you can still call it Microruby ;)

No no no, the correct answer is "It's okay if I call it Wuby; I'm takin'
the name back!"

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

"The ability to quote is a serviceable
substitute for wit." - W. Somerset Maugham

Martin DeMello

unread,
Mar 8, 2007, 1:12:42 PM3/8/07
to
On 3/8/07, Chad Perrin <per...@apotheon.com> wrote:
>
> Hey . . . if you were really planning a "top secret fork of Ruby for MS
> Windows", I'd say Wuby would be an *excellent* name for the language.
> One wonders, however, why you'd need to fork it for Windows.

He'd need to do it because Windows can't fork :)

martin

Daniel Berger

unread,
Mar 8, 2007, 1:25:23 PM3/8/07
to
On Mar 8, 11:10 am, Chad Perrin <per...@apotheon.com> wrote:
> On Thu, Mar 08, 2007 at 09:35:06PM +0900, Daniel Berger wrote:
> > On Mar 7, 11:14 pm, Chad Perrin <per...@apotheon.com> wrote:
> > > On Thu, Mar 08, 2007 at 03:50:17AM +0900, 7stud 7stud wrote:
> > > > > Don't worry. They'll go away. The Wuby moto is break what works, rename
> > > > > what's commonly known and add gotchas for fun.
>
> > > > I've seen it mentioned a couple of times--what the heck is wuby?
>
> > > It's a sarcastic, trollish way of saying "Ruby" if you're trying to
> > > convey a sense that it is childish.
>
> > Damn, it's also the name of my top secret fork of Ruby for MS Windows.
> > Windows + Ruby = Wuby. :)
>
> > I'm dwivin' in my car...
>
> Hey . . . if you were really planning a "top secret fork of Ruby for MS
> Windows", I'd say Wuby would be an *excellent* name for the language.
> One wonders, however, why you'd need to fork it for Windows.

A Windows-only fork would have several advantages.

First, I could use the native Windows API functions for everything and
not worry about *nix compatability.

Second, I could modify the core classes as I see fit to take advantage
of the Windows API functions.

Third, I could alter the API of some of the Ruby core classes and/or
modules where it makes sense to do so on Windows (i.e. get rid of the
Unix-isms, add Windows-isms).

Fourth, I could more easily handle Unicode issues (ties back to the
first reason).

Given the reasons above, I would scrap and completely rewrite the
following core classes:

Dir
File
File::Stat
IO
Process (and related modules)

And parts of:

Kernel
Regex
String

I would also make some pretty hefty changes to the standard library,
especially Socket.

Hypothetically speaking, of course. :)

Regards,

Dan

Dave Thomas

unread,
Mar 8, 2007, 1:29:53 PM3/8/07
to

On Mar 8, 2007, at 12:12 PM, Martin DeMello wrote:

> He'd need to do it because Windows can't fork :)


That's strange: I'm constantly overhearing people saying "forking
Windows!"

Chad Perrin

unread,
Mar 8, 2007, 1:39:16 PM3/8/07
to

I hadn't thought of that. Good point.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Chad Perrin

unread,
Mar 8, 2007, 1:39:33 PM3/8/07
to

+= 1

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

Chad Perrin

unread,
Mar 8, 2007, 1:42:30 PM3/8/07
to
On Fri, Mar 09, 2007 at 03:30:12AM +0900, Daniel Berger wrote:
> On Mar 8, 11:10 am, Chad Perrin <per...@apotheon.com> wrote:
> > On Thu, Mar 08, 2007 at 09:35:06PM +0900, Daniel Berger wrote:
> > > On Mar 7, 11:14 pm, Chad Perrin <per...@apotheon.com> wrote:
> > > > On Thu, Mar 08, 2007 at 03:50:17AM +0900, 7stud 7stud wrote:
> > > > > > Don't worry. They'll go away. The Wuby moto is break what works, rename
> > > > > > what's commonly known and add gotchas for fun.
> >
> > > > > I've seen it mentioned a couple of times--what the heck is wuby?
> >
> > > > It's a sarcastic, trollish way of saying "Ruby" if you're trying to
> > > > convey a sense that it is childish.
> >
> > > Damn, it's also the name of my top secret fork of Ruby for MS Windows.
> > > Windows + Ruby = Wuby. :)
> >
> > > I'm dwivin' in my car...
> >
> > Hey . . . if you were really planning a "top secret fork of Ruby for MS
> > Windows", I'd say Wuby would be an *excellent* name for the language.
> > One wonders, however, why you'd need to fork it for Windows.
>
> A Windows-only fork would have several advantages.
>
> First, I could use the native Windows API functions for everything and
> not worry about *nix compatability.

That's not a benefit of a Windows-only fork -- it's a "benefit" of
deciding you're not going to code for portability. Choosing a
Windows-only language is part of making the decision to ignore
portability, not a free pass so you don't have to make the decision.


>
> Second, I could modify the core classes as I see fit to take advantage
> of the Windows API functions.

Why can't you do that with Ruby -- or just create mutant relatives of
the Ruby core classes?


>
> Third, I could alter the API of some of the Ruby core classes and/or
> modules where it makes sense to do so on Windows (i.e. get rid of the
> Unix-isms, add Windows-isms).

You could do that anyway. Feel free to create Windows-only modules.


>
> Fourth, I could more easily handle Unicode issues (ties back to the
> first reason).

I think my answer to that is the same as my answer to the third point.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]

This sig for rent: a Signify v1.14 production from http://www.debian.org/

Daniel Berger

unread,
Mar 8, 2007, 2:00:20 PM3/8/07
to
On Mar 8, 11:42 am, Chad Perrin <per...@apotheon.com> wrote:

> > A Windows-only fork would have several advantages.
>
> > First, I could use the native Windows API functions for everything and
> > not worry about *nix compatability.
>
> That's not a benefit of a Windows-only fork -- it's a "benefit" of
> deciding you're not going to code for portability. Choosing a
> Windows-only language is part of making the decision to ignore
> portability, not a free pass so you don't have to make the decision.

Fair enough, but it would mean that I could drop the cruft of
supporting 95/98/ME, too. It would be an "NT Family only" fork.

> > Second, I could modify the core classes as I see fit to take advantage
> > of the Windows API functions.
>
> Why can't you do that with Ruby

Patches for Windows are a colossal pain (it requires modifying 3 files
as far as i can tell) and, in my experience, major patches are
unlikely to be accepted anyway.

> -- or just create mutant relatives of
> the Ruby core classes?

I've done that already to some extent with Win32Utils. But, to get
Unicode support, I would effectively have to redefine *every* method.

> > Third, I could alter the API of some of the Ruby core classes and/or
> > modules where it makes sense to do so on Windows (i.e. get rid of the
> > Unix-isms, add Windows-isms).
>
> You could do that anyway. Feel free to create Windows-only modules.

But you're forgetting the stdlib alterations.

Not to worry, though. I'm not really going to pursue it. Not without
VC funding, anyway. :)

Regards,

Dan

Chad Perrin

unread,
Mar 8, 2007, 2:50:03 PM3/8/07
to
On Fri, Mar 09, 2007 at 04:05:05AM +0900, Daniel Berger wrote:
> On Mar 8, 11:42 am, Chad Perrin <per...@apotheon.com> wrote:
>
> > -- or just create mutant relatives of
> > the Ruby core classes?
>
> I've done that already to some extent with Win32Utils. But, to get
> Unicode support, I would effectively have to redefine *every* method.

Ouch. Point taken.

Then again . . . you'd have to do that anyway, with a fork. Hmm. Can't
win for losing.


>
> But you're forgetting the stdlib alterations.
>
> Not to worry, though. I'm not really going to pursue it. Not without
> VC funding, anyway. :)

Oh, I don't think I have anything to fear from a Windows-only fork --
I'm not worried. I'm pretty sure Ruby, being portable where yours would
not and likely to provide better Unicode support than yours would by the
time you got yours into release-worthy status, wouldn't hurt any for the
competition. Besides, if all you forked was the implementation and
syntactic details that relate to platform-specificity, I'm pretty sure
the core Ruby would only benefit from the existence of such a close
relative.

. . especially if it was open source, so that each could benefit from
the development of the other.

Rick DeNatale

unread,
Mar 8, 2007, 4:37:53 PM3/8/07
to
On 3/7/07, John Joyce <dangerwillro...@gmail.com> wrote:
> Remember in those days, heck even in the 80's languages and tools
> (programs) used the shortest names possible because computing power
> and memory were at a premium so even saving one character made a
> difference. Thus we get all these sick little names for Unix tools,
> love them or hate them.

On the other hand. I once was talking to the late John Cocke. John
was one of the oldest language gurus at IBM, and was best known for
his work on optimizing compilers, and later for fostering RISC
architectures which relied on such compilation technology.

John told me that when he wrote his first FORTRAN compiler, he had it
accept something like 7 different spellings of the keyword CONTINUE,
because "I'll be damned if I'll let any compiler I write tell me I
can't spell."


--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

John Joyce

unread,
Mar 8, 2007, 7:08:56 PM3/8/07
to

On Mar 9, 2007, at 6:37 AM, Rick DeNatale wrote:

> On the other hand. I once was talking to the late John Cocke. John
> was one of the oldest language gurus at IBM, and was best known for
> his work on optimizing compilers, and later for fostering RISC
> architectures which relied on such compilation technology.
>
> John told me that when he wrote his first FORTRAN compiler, he had it
> accept something like 7 different spellings of the keyword CONTINUE,
> because "I'll be damned if I'll let any compiler I write tell me I
> can't spell."

Interesting, but if you type CONTINUE or elsif that many times and
get error messages, you're going to learn to spell it.

Bill Kelly

unread,
Mar 9, 2007, 2:06:45 AM3/9/07
to

From: "Jenda Krynicky" <je...@cpan.org>

>
> Well this is what you get if you force an already angry person to learn
> a butt ugly language because some managor never heard of anything other
> than ASP.Net, Java and Ruby on Rails. And decided (under these
> conditions correctly) that the best option is RoR.

It's true. Perl is unquestionably the least butt-ugly language ever.

:D

<3

Bill


Jenda Krynicky

unread,
Mar 9, 2007, 9:32:45 AM3/9/07
to

Makes sense. Except that it's a backwards incompatible change.

I don't see why can't the rubyists accept that sometimes it does make
sense to be able to explicitely declare a variable, to explicitely mark
an assignment as being more than as assignment, but rather also a
variable declaration. Even if allowing myself to ask Ruby to report a
compiletime error if I do not mark the first assignments is out of
question.

Jenda

John Joyce

unread,
Mar 9, 2007, 9:53:07 AM3/9/07
to
Jenda, certainly u b trollin'
"rubyists" accept whatever it is. Not all changes need to be
backward compatible. If changes are well documented and reduce
unintended side-effects, then they're fine and easy enough to fix.

Samantha

unread,
Mar 13, 2007, 10:58:31 AM3/13/07
to
Chad Perrin wrote:
> On Thu, Mar 08, 2007 at 09:10:19PM +0900, Marc Heiler wrote:
>> "The "Ruby in 20 Minutes" tutorial is obviously geared to the

>> Everyone should start with the pickaxe2, really. Or Pine tutorial. ;-)


>
> The Pickaxe has some severe shortcomings as an instructional text for
> people who are not experienced programmers. It's a great book in many
> ways, but for a newbie programmer, not so much. It assumes a fair bit
> of foreknowledge.
>
> I'm glad Messrs. Thomas and Hunt didn't decide to try to make the
> Pickaxe everything to everyone. Books that result from such an attempt
> tend to be notoriously bad at being anything to anyone. Pick a target
> audience for your book, and stick to it -- you'll have better luck that
> way. The Pickaxe is great within its niche. Just don't make the
> mistake of thinking that niche is for people who are new to programming.
>


I bought the Pickaxe and did great with it for the first few chapters.
I read it religiously. Big game - Michigan vs. Ohio State. (GO BLUE!)
I brought the Pickaxe with me to the 'in-law's' and read the book while
my partner watched the game. I was glued to it.

But, at a certain point, I got lost. Even though I had gone through the
Pine tutorial (not as thoroughly as I should have, but I have a crappy
attention span), and even though I had taken a logic and design course
in school... I got lost.

I have found that just eventually writing little stupid things and
seeing what tweaks I could make to those little tweaks, as well as
asking questions on this list, participating with my Ruby Mentor(s), and
going through code has been invaluable.

Now, I'm starting to go through the Pickaxe again, with a little bit
more experience and understanding this time. I'm nowhere near the skill
level of being able to write wonderful applications/programs, but I'm
better than when I first posted to this list. I'm even highlighting
things now. Wahoo!

-Samantha


0 new messages