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 ;-)


In reply to Re: Why perl is more OO than C++ or Java... by Starky
in thread Why perl is more OO than C++ or Java... by dragonchild

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.