{...} there is prior art on this from Smalltalk. I'd be surprised if you haven't run across it. {...}
So, to test your theory, I took the latest Squeak Smalltalk image (arguably derived directly from the original Xerox Park Smalltalk80 Image), and ran a few tests:
Metaclass allInstances size -> 1280
So there are 1280 classes in the current image. Now how many of them understand "new" as an instance method:
Metaclass allInstances select: [:m | m soleInstance includesSelector: +#new] -> #(Behavior class Metaclass class)
There. The only two classes that have instances that understand #new are the things that act as factories: Behavior and Metaclass. And the code for Metaclass instances basically just says "don't do that" and throws an error. {grin} And the code is in Behavior so that all object classes also know how to #new themselves.

So I go by my original hypothesis. In classic OO programming, best illustrated by Smalltalk80, the word "new" contains the strict connotation of "make a new instance of", and is applied only to class objects, not to instance objects.

By contrast, the Object implements both #clone (as a primitive) and #copy (to allow overriding for shallow copy vs deep copy), so every object knows how to clone itself.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


In reply to •Re: Re: Re: Re: Mmmm ... cargo cult progamming is nummy! by merlyn
in thread Adding autoloaded methods to symbol table with using strict refs by strat

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.