At 9:30 AM -0700 4/23/04, chromatic wrote:
On Fri, 2004-04-23 at 05:42, Dan Sugalski wrote:

 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.

(hypothetical pre-breakfasty musings)


Such as a PerlUndef with the 'expected_type' property set to 'Joe'?

Sure, that's doable, as are a number of other things. Depends on the semantics of assignment to uninitialized types, though that's on a per-type basis. This all gets somewhat messy when you mix in objects and types, since what you'd do for storage depends on a number of factors. (Like we want a low-level int if that was "my int $foo", a generic restriction on what it can hold a reference to if Joe's just a dull class, or impose assignment semantics on if it's a bit more active)
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to