Forum: Ruby elseif v. elsif ??

54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 09:56
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
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-07 10:00
(Received via mailing list)
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"
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 10:04
(Received via mailing list)
On 3/7/07, 7stud 7stud <dolgun@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
D6fca3e33a1112eae1c73c22c83c63d6?d=identicon&s=25 Hans Sjunnesson (Guest)
on 2007-03-07 10:20
(Received via mailing list)
On Mar 7, 9:56 am, 7stud 7stud <dol...@excite.com> wrote:
> Ruby two thumbs down.
>
> C++, Java,  Javascript, php, Servlets+JSP programmer
>
> --
> Posted viahttp://www.ruby-forum.com/.

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?
C40020a47c6b625af6422b5b1302abaf?d=identicon&s=25 Stefano Crocco (crocco)
on 2007-03-07 10:36
(Received via mailing list)
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
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 10:37
(Received via mailing list)
On 3/7/07, Hans Sjunnesson <hans.sjunnesson@gmail.com> wrote:
> > explicitly pointed out in a beginning tutorial?  So far, I have to give
> (NoMethodError)" when you use 'elseif', so it's really not a problem
> is it?
>
> --
> Hans
>
>
>
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
A8486651a974d7d9ecc35d25de96c7ee?d=identicon&s=25 Chris Lowis (chrislo)
on 2007-03-07 10:59
> 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-fro...

I find this page very helpful.

Regards,


Chris
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 11:30
(Received via mailing list)
On 3/7/07, Stefano Crocco <stefano.crocco@alice.it> wrote:
<snip>

Good points Stefano, conclusion *always* use "then" :)
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 11:54
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-fro...
>
> 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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 11:57
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]
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (Guest)
on 2007-03-07 12:02
(Received via mailing list)
On Wed, Mar 07, 2007 at 07:54:15PM +0900, 7stud 7stud wrote:
>         #functions:
>         end
> end
> if __FILE__ == $0
>         mg = MegaGreeter.new(["Sally", "Jane", "Bob"])
>         mg.say_hi
> end

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

Try: mg = MegaGreeter.new(nil)
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 12:05
(Received via mailing list)
On 3/7/07, 7stud 7stud <dolgun@excite.com> wrote:
> --
> Posted via http://www.ruby-forum.com/.
>
>

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

Robert
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 12:06
(Received via mailing list)
On 3/7/07, Brian Candler <B.Candler@pobox.com> wrote:
> >
> >                 end
>
>
You spoiled it ;)
but this is a good way to explain it too...
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 12:08
> Perhaps at the "Ruby from other languages" page :
> http://www.ruby-lang.org/en/documentation/ruby-fro...

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.
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (Guest)
on 2007-03-07 12:11
(Received via mailing list)
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)
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 12:18
>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?
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 12:24
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?
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 12:28
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'.
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (Guest)
on 2007-03-07 12:32
(Received via mailing list)
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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 12:37
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.
93d566cc26b230c553c197c4cd8ac6e4?d=identicon&s=25 Pit Capitain (Guest)
on 2007-03-07 12:41
(Received via mailing list)
7stud 7stud schrieb:
>
>                 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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 12:50
> 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.
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 12:53
(Received via mailing list)
On 3/7/07, 7stud 7stud <dolgun@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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 13:01
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.
93d566cc26b230c553c197c4cd8ac6e4?d=identicon&s=25 Pit Capitain (Guest)
on 2007-03-07 13:24
(Received via mailing list)
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
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-07 13:29
(Received via mailing list)
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".
1fba4539b6cafe2e60a2916fa184fc2f?d=identicon&s=25 David A. Black (Guest)
on 2007-03-07 14:18
(Received via mailing list)
Hi --

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

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

No -- literally never.


David
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 14:20
(Received via mailing list)
On 3/7/07, Chad Perrin <perrin@apotheon.com> 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".
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
88521907e2c9c585bc94e35a38893dc5?d=identicon&s=25 Jenda Krynicky (jendaperl)
on 2007-03-07 14:37
David A. Black wrote:
> Hi --
>
> On 3/7/07, 7stud 7stud <dolgun@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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 15:22
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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 15:24
Also, to be consistent, shouldn't it be:

z = if x < y
  true
els
  false
end
Ae16cb4f6d78e485b04ce1e821592ae5?d=identicon&s=25 Martin DeMello (Guest)
on 2007-03-07 15:36
(Received via mailing list)
On 3/7/07, 7stud 7stud <dolgun@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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 15:49
>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
7a561ec0875fcbbe3066ea8fe288ec77?d=identicon&s=25 Sebastian Hungerecker (Guest)
on 2007-03-07 15:57
(Received via mailing list)
7stud 7stud wrote:
> How do you turn on syntax highlighting with vim?

:syntax on
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 16:02
(Received via mailing list)
On 3/7/07, Martin DeMello <martindemello@gmail.com> wrote:
>
> and
>
>

Thank you Martin, I started to feel lonely ;)
R
4dea430d31b993abaf41cd9b54f8128d?d=identicon&s=25 Avdi Grimm (avdi)
on 2007-03-07 16:16
(Received via mailing list)
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.
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-03-07 16:28
(Received via mailing list)
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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 17:24
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.  :)
F3121a9b0999cefc9bf2d9a68439d258?d=identicon&s=25 Brian Adkins (Guest)
on 2007-03-07 17:26
(Received via mailing list)
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!
:)
88521907e2c9c585bc94e35a38893dc5?d=identicon&s=25 Jenda Krynicky (jendaperl)
on 2007-03-07 17:45
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
00d064218a7eb2ae541f4fd500026b1e?d=identicon&s=25 Andrew Koenig (Guest)
on 2007-03-07 18:16
(Received via mailing list)
"Chad Perrin" <perrin@apotheon.com> wrote in message
news:20070307085933.GB25634@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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2007-03-07 19:50
> 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?
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (austin)
on 2007-03-07 19:53
(Received via mailing list)
On 3/7/07, 7stud 7stud <dolgun@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
Bef7ff8a0537495a1876ffebdc9f8e51?d=identicon&s=25 Lionel Bouton (Guest)
on 2007-03-07 20:20
(Received via mailing list)
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
Cff9eed5d8099e4c2d34eae663aae87e?d=identicon&s=25 Jacob Fugal (Guest)
on 2007-03-07 21:51
(Received via mailing list)
On 3/7/07, Austin Ziegler <halostatue@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
Ec5a599777854c540fd102ef4691fe10?d=identicon&s=25 Rimantas Liubertas (Guest)
on 2007-03-07 21:56
(Received via mailing list)
> 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
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 21:57
(Received via mailing list)
On 3/7/07, Jacob Fugal <lukfugl@gmail.com> wrote:
> 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?

Robert
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (regularfry)
on 2007-03-07 22:15
(Received via mailing list)
Robert Dober wrote:
>> 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:ww...

Not definitive, but certainly interesting.  Also:

http://66.102.9.104/search?q=cache:95o0skP5sNAJ:ww...
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-07 22:48
(Received via mailing list)
On 3/7/07, Alex Young <alex@blackkettle.org> wrote:
> >> that ruby-forum.com does send a activation email, but perhaps someone
> > What'd you think?
> Alex
>
>
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
56f2ce19706d05d18b5b66483aa13f98?d=identicon&s=25 Lloyd Zusman (Guest)
on 2007-03-08 00:32
(Received via mailing list)
7stud 7stud <dolgun@excite.com> writes:

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

It may seem like a ridiculous construct to you, but for lots of people
who have programmed in other languages, "elsif" is not unusual.  That
spelling has been in use for some 40 years in other languages that many
people are familiar with.

Since ruby has been around for more than 14 years and has probably
thousands of people writing programs in it and probably millions of
lines of code, I wouldn't hold my breath waiting for anyone to change
the spelling of "elsif", because that would break a lot of existing
software ... irrespective of how ridiculous that spelling might seem to
you and other people.
56f2ce19706d05d18b5b66483aa13f98?d=identicon&s=25 Lloyd Zusman (Guest)
on 2007-03-08 00:35
(Received via mailing list)
"Robert Dober" <robert.dober@gmail.com> writes:

>
> 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
9a4ae17201525474ec26e5d89b66477e?d=identicon&s=25 Michael P. Soulier (Guest)
on 2007-03-08 03:42
(Received via mailing list)
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
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-03-08 04:31
(Received via mailing list)
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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:01
(Received via mailing list)
On Wed, Mar 07, 2007 at 10:19:23PM +0900, Robert Dober wrote:
> >> LOOK AT THE ELSIF SYNTAX CAREFULLY--IT'S 'ELSIF' NOT 'ELSEIF'
> 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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:03
(Received via mailing list)
On Thu, Mar 08, 2007 at 08:35:09AM +0900, Lloyd Zusman wrote:
> > nobody can judge at that level. This explaination took a whole article
>   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".
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:08
(Received via mailing list)
On Wed, Mar 07, 2007 at 11:35:41PM +0900, Martin DeMello wrote:
>
> and
>
> z = if x < y
>  -1
> elsif x == y
>   0
> elsif x < y
>   1
> end

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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:11
(Received via mailing list)
On Thu, Mar 08, 2007 at 12:28:10AM +0900, John Joyce wrote:
> 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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:15
(Received via mailing list)
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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:16
(Received via mailing list)
On Thu, Mar 08, 2007 at 04:20:27AM +0900, Lionel Bouton wrote:
> 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 :-)

Ahh, the silver lining.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:22
(Received via mailing list)
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:ww...
>
> Not definitive, but certainly interesting.  Also:
>
> 
http://66.102.9.104/search?q=cache:95o0skP5sNAJ:ww...

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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 07:24
(Received via mailing list)
On Thu, Mar 08, 2007 at 02:15:07AM +0900, Andrew Koenig wrote:
> "Chad Perrin" <perrin@apotheon.com> wrote in message
> news:20070307085933.GB25634@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.

I was being slightly facetious.  I really don't see anything
particularly wrong with any of these variations that have been discussed
here.
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2007-03-08 07:55
(Received via mailing list)
Hi,

In message "Re: elseif v. elsif ??"
    on Thu, 8 Mar 2007 15:00:36 +0900, Chad Perrin <perrin@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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 08:29
(Received via mailing list)
On Thu, Mar 08, 2007 at 03:54:10PM +0900, Yukihiro Matsumoto wrote:
> |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'.

. . . 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.
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-08 08:33
(Received via mailing list)
On 3/7/07, Lloyd Zusman <ljz@asfast.com> wrote:
> > nobody can judge at that level. This explaination took a whole article
>   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
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-03-08 08:35
(Received via mailing list)
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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 11:39
(Received via mailing list)
On Thu, Mar 08, 2007 at 04:34:21PM +0900, John Joyce wrote:
> 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.

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.
88521907e2c9c585bc94e35a38893dc5?d=identicon&s=25 Jenda Krynicky (jendaperl)
on 2007-03-08 12:48
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:ww...
>>
>> Not definitive, but certainly interesting.  Also:
>>
>> 
http://66.102.9.104/search?q=cache:95o0skP5sNAJ:ww...
>
> 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.
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2007-03-08 13:10
"The "Ruby in 20 Minutes" tutorial is obviously geared to the
experienced programmer"

Everyone should start with the pickaxe2, really. Or Pine tutorial. ;-)
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (Guest)
on 2007-03-08 13:32
(Received via mailing list)
On Thu, Mar 08, 2007 at 08:49:00PM +0900, Jenda Krynicky wrote:
>
> 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.
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (Guest)
on 2007-03-08 13:35
(Received via mailing list)
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
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-03-08 13:49
(Received via mailing list)
On 3/8/07, Daniel Berger <djberg96@gmail.com> wrote:
> 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
>
>
>
Cheer up you can still call it Microruby ;)
R
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (regularfry)
on 2007-03-08 14:57
(Received via mailing list)
Jenda Krynicky wrote:
>>> 
http://66.102.9.104/search?q=cache:95o0skP5sNAJ:ww...
>> 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 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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 19:07
(Received via mailing list)
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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 19:10
(Received via mailing list)
On Thu, Mar 08, 2007 at 09:35:06PM +0900, Daniel Berger wrote:
> 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.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 19:11
(Received via mailing list)
On Thu, Mar 08, 2007 at 09:48:49PM +0900, Robert Dober wrote:
> >> 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!"
Ae16cb4f6d78e485b04ce1e821592ae5?d=identicon&s=25 Martin DeMello (Guest)
on 2007-03-08 19:13
(Received via mailing list)
On 3/8/07, Chad Perrin <perrin@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
5d06917e13b29bcff1c1609492c06873?d=identicon&s=25 Dave Thomas (Guest)
on 2007-03-08 19:30
(Received via mailing list)
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!"
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (Guest)
on 2007-03-08 19:31
(Received via mailing list)
On Mar 8, 11:10 am, Chad Perrin <per...@apotheon.com> wrote:
>
> > 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
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 19:39
(Received via mailing list)
On Fri, Mar 09, 2007 at 03:12:42AM +0900, Martin DeMello wrote:
> On 3/8/07, Chad Perrin <perrin@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 :)

I hadn't thought of that.  Good point.
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 19:40
(Received via mailing list)
On Fri, Mar 09, 2007 at 03:29:53AM +0900, Dave Thomas wrote:
> 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!"

+= 1
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 19:42
(Received via mailing list)
On Fri, Mar 09, 2007 at 03:30:12AM +0900, Daniel Berger wrote:
> > > > convey a sense that it is childish.
> 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.
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (Guest)
on 2007-03-08 20:05
(Received via mailing list)
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
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-03-08 20:50
(Received via mailing list)
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.
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2007-03-08 22:38
(Received via mailing list)
On 3/7/07, John Joyce <dangerwillrobinsondanger@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/
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-03-09 01:09
(Received via mailing list)
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.
4feed660d3728526797edeb4f0467384?d=identicon&s=25 Bill Kelly (Guest)
on 2007-03-09 08:07
(Received via mailing list)
From: "Jenda Krynicky" <jenda@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
88521907e2c9c585bc94e35a38893dc5?d=identicon&s=25 Jenda Krynicky (jendaperl)
on 2007-03-09 15:32
Brian Candler wrote:
> On Thu, Mar 08, 2007 at 08:49:00PM +0900, Jenda Krynicky wrote:
>>
>> 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.

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
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-03-09 15:53
(Received via mailing list)
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.
181af584c3f0598b18cedfaf32b68eb5?d=identicon&s=25 Samantha (Guest)
on 2007-03-13 15:59
(Received via mailing list)
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

> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.