On Fri, Apr 23, 2004 at 08:42:28AM -0400, Dan Sugalski wrote:
: At 11:29 PM +0100 4/22/04, Simon Cozens wrote:
: >[EMAIL PROTECTED] (Dan Sugalski) writes:
: >>     my Joe $foo;
: >>
: >> emits the code that, at runtime, finds the class ID of whatever Joe's
: >> in scope, instantiates a new object of that class
: >
: >Uh, is that right? I don't think that "my" is a constructor, more a typing
: >declarator.
: 
: Since any type potentially has assignment behaviour, it has to be a 
: constructor. For example, if you've got the Joe class set such that 
: assigning to it prints the contents to stderr, this:
: 
:    my Joe $foo;
:    $foo = 12;
: 
: should print 12 to stderr. Can't do that if you've not put at least a 
: minimally constructed thing in the slot.

Yes.  More typically, the type of the value needs to be checked
at assignment time, if we can't intuit its safety at compile time.
>From an abstract point of view the constructor in question isn't so much
constructing a Joe object as a container for a Joe object--though, of
course, optimizations happen.  So in the Parrot engine the containers
and containees are a bit more incestuous than it would appear from
the abstract language level.  That's okay.

Larry

Reply via email to