B
Bill Kelly
Hi,
Ah, sorry - I wasn't intending to compare Smalltalk directly
to Ruby here. I got into Smalltalk (albeit briefly) before I'd
heard of Ruby.
From http://en.wikipedia.org/wiki/Smalltalk_programming_language
One surprising feature of Smalltalk is that the traditional
progamming constructs: if-then-else, for, while, etc. are
not built into the language. All of these things are
implemented using objects. For example, decisions are made
by sending an ifTrue: message to a Boolean object, and passing
a fragment of code to execute if the Boolean is True. There
are only three built-in executable constructs:
- sending a message to an object;
- assigning an object to a variable;
- returning an object from a method;
and a few syntactic constructs for declaring literal objects
and temporary variables.
But the above was something that delighted me about Smalltalk
when learning about it. It just seemed like a mark of quality
to me that its designer had been able to derive a useful,
expressive syntax from so few essentials.
(Of course just prior to studying Smalltalk I had unwisely
volunteered to take over a large VB6 project... If only I'd
spent 15 minutes studying the VB6 language reference before
agreeing to that.... Gack!
... Ruby rocks ...
Regards,
Bill
From: "Csaba Henk said:What do you mean by "needing" if? Ruby neither needs if, it just has it.
Ah, sorry - I wasn't intending to compare Smalltalk directly
to Ruby here. I got into Smalltalk (albeit briefly) before I'd
heard of Ruby.
From http://en.wikipedia.org/wiki/Smalltalk_programming_language
One surprising feature of Smalltalk is that the traditional
progamming constructs: if-then-else, for, while, etc. are
not built into the language. All of these things are
implemented using objects. For example, decisions are made
by sending an ifTrue: message to a Boolean object, and passing
a fragment of code to execute if the Boolean is True. There
are only three built-in executable constructs:
- sending a message to an object;
- assigning an object to a variable;
- returning an object from a method;
and a few syntactic constructs for declaring literal objects
and temporary variables.
But the above was something that delighted me about Smalltalk
when learning about it. It just seemed like a mark of quality
to me that its designer had been able to derive a useful,
expressive syntax from so few essentials.
(Of course just prior to studying Smalltalk I had unwisely
volunteered to take over a large VB6 project... If only I'd
spent 15 minutes studying the VB6 language reference before
agreeing to that.... Gack!
You can define if/then/else type methods for objects with a few line of
Ruby code easily (without using "and", "case" and any other
conditional-like construct, of course, I mean it that way). I made it up
to have
loop {
gets.ifthen {
puts "you fed me a line"
}.else {
puts "bye"; exit
}
}
as valid code.
... Ruby rocks ...
Regards,
Bill