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/.
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
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
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
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
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
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
Good points Stefano, conclusion *always* use "then" :)
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
~/2testing/dir1$ ruby rubyHelloWorld.rb
Hello SallyJaneBob!
ruby version:
~/2testing/dir1$ ruby -v
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]
That's because you're not exercising the section under @names.nil?
Try: mg = MegaGreeter.new(nil)
I could explain why, but just follow Stefano's advice and put "then"
after each if elsif and elseif and you will see.
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.
and a good argument for code coverage testing (e.g. rcov)
>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?
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.
>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.
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
Ok, thanks.
#!/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
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 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
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
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)
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
>
>
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.
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.
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
How do you turn on syntax highlighting with vim?
IM - Vi IMproved
~
~ version 6.2
:syntax on
--
Ist so, weil ist so
Bleibt so, weil war so
Thank you Martin, I started to feel lonely ;)
R
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
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! :)
Hey, I can see the elseif error now. :)
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
> "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'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
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
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
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/
What'd you think?
Robert
>
> Jacob Fugal
>
> [1] ruby-talk:242290
>
>
Observe:
Not definitive, but certainly interesting. Also:
--
Alex
This does not concern me anymore.
Thx Alex I am grateful, was about to make a complete fool out of myself :(
Cheers
Robert
> 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
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.
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."
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."
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
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
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
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);
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.
. . 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 ]
si puede ser
Cheers
Robert
>
> --
> Lloyd Zusman
> l...@asfast.com
> God bless you.
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 ]
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.
Everyone should start with the pickaxe2, really. Or Pine tutorial. ;-)
FWIW, I understand this is/has changed in ruby 1.9, so that block
parameters are always local to the block.
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
> 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
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 ]
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 ]
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
He'd need to do it because Windows can't fork :)
martin
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
> He'd need to do it because Windows can't fork :)
That's strange: I'm constantly overhearing people saying "forking
Windows!"
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/
> > 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
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.
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/
> 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.
It's true. Perl is unquestionably the least butt-ugly language ever.
:D
<3
Bill
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
>> 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