On Saturday 02 November 2002 7:57 pm, Enric Lafont wrote:
> Hi all,
>
> I'm a Ruby newbie, and I'm reading now "the ruby way" and reading this
> book some comments make me think.
> I've a strong  Smalltalk heritage,  so I'm somewhat biassed.

Hi, Enric.
I also have a Smalltalk background.  When I first encountered Ruby I asked 
myself many of the same questions you have.

>
> I would like to know...
>
> Why does common operators like "=" , "and", " .." , "or"  etc ... can
> not be overloaded or redefined ?, maybe the complexity of the Ruby
> parser comes from the fact that everything is ALMOST an object or a
> method. Why is not "=" a method ? Same question for "and" and the rest
> of operators that can not be redefined, Does the actual implementation
> make life easier for the designer ? I say so because for me is more
> natural when everything is an object (without exceptions, here Ruby
> follows the rule pretty well) and a method is a method ever, not
> sometimes. Some methods are keywords, and some other are not v.g. loop
> vs. while. The every call is a method could simplify greatly the sintax
> parser (look at the Smalltalk parser).

Smalltalk is pure OOP.  Ruby is not.  In Smalltalk the "operators" are simply 
messages to an object.  In Ruby "operators" are neither objects nor messages, 
but are rather handled as in more conventional languages.  I don't know why 
Matz only went part way.   This part-way-ness is also visible in other 
aspects of the language such as "if", "while", etc.  In Ruby these things 
also are neither object nor message. Whereas in Smalltalk, such constructs 
are messages to a Boolean object. 

>
> Why  primitives are hidden ? In smalltalk you can call a primitive every
> time you want with a  <primitive: aNumber> , this way the implementation
> of native methods, and in some way native Classes like String are not
> hidden from the programmer, freeing the programmer to change the
> behaviour if needed. Yes you can have the "required" clause and use
> binary libraries, but would not be much more "natural" to have a
> "require string" when you want to invoque string libraries instead of
> having them loaded all the time ?. I want to say here that the
> "primitive" keyword frees the language from it's implementation. This
> favours the everything is a module aproach.

Again, what can I say? Ruby is not Smalltalk.  Large amounts of functionality 
that in Smalltalk were written in Smalltalk, were in Ruby written in C.

>
> Sintax Sugar (SS), other thing difficult to understand for me, the
> question here is why ? Everything has exceptions very few things are
> orthogonal with the principe that must drive it, you can wite a.+(3) or
> a + 3 or a.+ 3 or a hundred other ways to write the same thing, yes,
> this gives you freedom, but a bad deserved (not needed) one. I use one
> form, but when I read programs from other persons the code seems strange
> and somewhat dificult to read. Sometimes SS is right, v.g. x +=1, but
> the every call is a method aproach could give you the same results
> without trouble, in this case += could  be a method. As could be "++" or
> others.

I agree with you for the same reasons you give.  I am a hater of syntax sugar.  

>
> Undeclared variables, I don't know other people but I do fast typing and
> writing  "aVariable" and "aVariabel" is a mistake that I can do very
> easily. Yes you can say, type more slowly, but this is not a solution, I
> would like to have a way to force the compiler to generate a warning
> when I use a non pre-declared (or pre asigned) variable.

This is a difference that I have grown to like.  Running back to the top of a 
method every I need a variable name was tedious.  

>
> Why are Strings arrays of integers ? aString[0] is an integer, yes, it's
> the way it is, but I would like to have String as an array of chars, and
> char if you want as a descendant of Integer (nice election because a
> Unicode String is and array of double chars i.e. integer), I don't know
> you, but for me aString[i].chr =='x' is somewhat unnatural, because it
> breaks the semantic of a String, so it's not intuitive for me.

It is not intuitive to many people.  There have been long discussions on the 
pros and cons.

>
> Why is Ruby an interpreter ? Yes the less traditional bytecode aproach,
> can be harder (or not), but enables external optimizations more easily
> (JIT and similars) because the language are separated from the
> implementation, enables reduced footprint and gives faster execution
> times, yes, look at how Self executes programs, it's amazingly fast (and
> incredibly complex also), but a separated implementation could help
> develop better Ruby-engines.

All the things you mention are under consideration or under development.

>
> Don't get me wrong, I understand that Ruby is a young language that
> needs some maturing, and I love how easy is to learn, it's dinamicity
> and the fact that is a kind of mix between my loved Smalltalk, Self and
> other languages. In fact I'm writing this because I want to understand
> Ruby better and becasue I want to make some suggestions for future
> releases, maybe Mr. Matsumoto would like to consider some of them

Most of the features I loved about Smalltalk are in Ruby.  But what I do not 
miss from Smalltalk is fact that it is image based.  Ruby is not, and I think 
that is a good thing.

>
> There are more things that I see as strange in Ruby, but this is enought
> for now .....
>
> Please if I've make any inaccuracy , don't be too rude with me, I'm
> still learning, and I've a loooong way before understand everyting. I'm
> just looking for answers.

I think you will find that this is a very friendly list.  Welcome.

>
> Enric

-- 
"I invented the term Object-Oriented, and I can 
tell you I did not have C++ in mind."
                                            -Alan Kay