in reply to Why perl is more OO than C++ or Java...

Just to bring the discussion right round, I thought I'd mention the textbook definition of an object: It is something that has identity, state, and behavior. That's all.

If you think of a behavior of the scalar as, for example, to place itself in the proper context depending on the operator operating on it (as it does in Perl), state as the value and other meta-attributes associated in the Perl guts with the scalar, and identity as, well, I'm kinda digging here, but the name of the scalar, then dragonchild is exactly right (and with a keen observation): A scalar is an object.

(I am but a lowly mathematician, so any CS folks out there who know better please pipe in if I am wrong. For reference, this definition of an object comes from "Object-Oriented Analysis and Design" by Grady Booch, 2nd Ed., p. 83.)

This observation is somewhat amusing to me in light of all of the discussion insofar as everyone seems to be debating whether Perl is OO or how OO Perl is. Perhaps one could argue that Perl is so very successfully OO that Perl programmers don't even know they're using objects?

Ah, the irony ;-)

  • Comment on Re: Why perl is more OO than C++ or Java...