mark wrote:
> On Monday 01 Sep 2003 9:47 am, Hannu Kankaanpää wrote:
> 
>>I was quite humoured by this article:
>>http://www.cs.washington.edu/homes/kd/courses/pythonruby.pdf
>>
>>It said having to use abs(-5) instead of -5.abs is a "major problem
>>with Python". And I'm afraid they were serious, even though that's
>>not far from begin complete nonsense.
> 
> 
> They also seemed to be offended by being able to type
> 
> print "Hello world"
> 
> Though from their second alternative I guess they weren't aware that you can 
> write
> 
> STDOUT.print "Hello world"
> 
> Though IMHO having to write STDOUT all the time would get tiresome very 
> quickly (and "hello world".print just looks weird)
> 
> So I'd say that Ruby has the right balance of purity and practicality.
> 
> 
>>They were not concerned with
>>the syntactic difference between overloaded operator calls and normal
>>function calls, for example. Or that some might actually prefer abs(x).
>>Oh boy, would they enjoy Lisp or Scheme. For some reason, most of us
>>don't.

I think the author was a little mistaken about Ruby though.  You don't 
call methods of a numerical object to perform most math operations like 
sin and such.  That's all provided by the Math module (unless things 
have changed since Dave and Andy's "Programming Ruby").  -5.abs is the 
only math-like method of a number, as far as I know.

I didn't agree with the "Hello world" example either.  I don't think 
it's a question of how you perform tasks with an object as much as which 
module's job is it to do what.  OOP doesn't mean every object needs a 
method for everything that can possibly be done with itself.

In my opinion, -5.abs seems right; -5 and 5 are the same, except one has 
the property of being negative and the other does not.  It makes sense 
to me that -5 would know how to represent itself without it's negative 
property.  The object holds the value 5, with a property that equates to 
"negative=true".

Along that same line of thinking, sin(5) seems right too.  sin(5) is NOT 
the same as 5, and I don't expect 5 to know how to the result of its 
sine function result.  That's the job of a math module.

The method print doesn't seem to me to belong, logically, to the string 
"Hello world", so I don't expect the string to know how to print itself. 
  It does seem to me to belong as a method of $stdout, however.

I remember back in the early 90's when I first dove into C++, there 
seemed to be this thought process regarding OOP that went something 
like: every object should be able to stand alone and interact rarely, if 
ever, with anything else because that would break the object's 
encapsulation.  I got that feeling from several texts, and I thought it 
ludicrous at the time, and still do.  As things have evolved, it seems 
common sense has stepped in to replace those purist theories, but that 
article really took me back to that time.

	Sean O'Dell