R
Robert Klemme
In Smalltalk, if-then-else is a message and messages are objects....
If Ruby is 100% OOP, then what is Smalltalk?
Probably more in the 120% area. ;-)
robert
In Smalltalk, if-then-else is a message and messages are objects....
If Ruby is 100% OOP, then what is Smalltalk?
Probably more in the 120% area. ;-)
robert
Smalltalk IS somehow metaphysical! quantum-something.LOL... That makes Smalltalk somehow metaphysical... It's like
saying I am 120% human... That is 20% more human than a human can
be.... scary
Enrique Comba Riepenhausen
But to answer your actual question, your friend is correct. for, case,
do, else, if, etc. are reserved words, not objects. Check your pickaxe
book, page 329.
Smalltalk is the purest OOP language there is and it doesn't **have**
if or unless at all. You know how you can bypass control structures in
Ruby by using blocks and closures instead? In Smalltalk, that's the
only way to do control structures at all. "If" and "unless" don't even
exist in Smalltalk.
Lucas said:Hi,
I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.
How can I defend the claim that Ruby is 100% OOP?
Hi,
I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.
How can I defend the claim that Ruby is 100% OOP?
Lucas said:Hi,
I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.
How can I defend the claim that Ruby is 100% OOP?
Hmm... there could be some bizarre and interesting possibilities.I have to wonder what exactly the benefit of having control structures
as objects would be? The bottom line effectiveness of any language
relates to what one can accomplish with it and how efficiently said
task
can be accomplished. Under what circumstance would overriding the "if"
method be beneficial? Not to mention the fact that since Ruby provides
the ability to override things like operators and more functional
components (that can be more logically represented as objects),
then why
would the lack of control structure object orientation make Ruby
less of
an OO language? Not to mention the kind of trouble that one could
easily
get into attempting to override control structures.
Hmm... there could be some bizarre and interesting possibilities.
For example, instead of if,
why not a construct called 'perhaps' or 'maybe' to include randomness
or other interesting side-effects.
Or even 'occasionally' or 'usually' for weighted randomness.
Not entirely true.
Yes, in Smalltalk control structures are built using methods on
Booleans and Blocks, and with Block arguments.
On the other hand, most Smalltalk implementations cheat on this.
There's an old VM implementors mantra that you have to cheat so you
have to work hard not to get caught cheating. In practice if:else:
gets compiled down to test and branch bytecodes, with exception
processing to handle the rare case where the receiver isn't a boolean.
Evaluating a block in Smalltalk looks like a message send but in
reality it's usually implemented as optimized byte code sequences
after some analysis. This led to some mystifying code reading. The
One has to be careful about that, it depends how the oat is grownwell, a car fueled by oats would probably be carbon neutral...
RobertOatman
would indeed be as least as eco-friendly as captain planet! Picard's brother?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.