On Sunday 03 November 2002 5:53 am, Anders Bengtsson wrote:
> Albert Wagner wrote:
> > 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.
>
> If Ruby went all the way on this, like Smalltalk does, then Ruby would
> almost *be* Smalltalk.
> The unique about Ruby is that it combines the OO-ness of Smalltalk with
> a more conventional syntax. I love Smalltalk's syntax, but it did scare
> a lot of people away.

Yes, superficially, just looking at a piece of Smalltalk code, without 
understanding what it means, a lot of people come away with the wrong idea: 
"Smalltalk syntax is wierd and complicated".  Actually, Smalltalk syntax is 
absurdly simple:  There are ONLY objects and messages. e.g.

conventional language:

if <boolean expression>
	codeExecutedIfBooleanIsTrue
else
	code ExecutedIfBooleanIsFalse
end

Smalltalk:

<boolean expression>
	IfTrue: [ codeExecutedIfBooleanIsTrue]
	IfFalse: [ codeExecutedIfBooleanIsFalse]

This does indeed look strange and complicated until you realize that <boolean 
expression> is an object, that can be sent the message IfTrue: with a code 
block as an argument that is evaluated by the boolean object if <boolean 
expression> evaluates to True.  It is exactly the same syntax as:

[boolean expression]			# object is code block that answers a boolean
	whileTrue: [ code here ]		# whileTrue: [] is message sent to code block

and:

1 to: 6 do: [ :integer | code here ]  # object is integer 1
							# to: 6 do: [ ] is message sent to integer 1

It is this consistency in pure languages that cause problems for people coming 
from such languages to Ruby.  The corrolary is people coming from simple 
procedural languages (C) and hybrid languages (C++) who have trouble grasping 
the almost pureness of Ruby.  Ruby sits midway between canonical pure OOP 
(Smalltalk) and procedural/hybrid languages.  Whether you enter Ruby from the 
left or right you are bound to be suprised.
<snip>

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