At 10:23 AM 9/1/00 -0700, Larry Wall wrote:
>Dan Sugalski writes:
>: Type returns a magic cookie value of some sort (Not sure what sort yet),
>: name returns a string with the name of the type of the variable.
>
>Why can't the type object just stringify to the name of the type?

I'd figured that the type would be an integer, rather than an object, and 
one that wouldn't necessarily map to just one 'real' variable type. A tied 
integer, for example, would return an integer type though the name would 
likely be the package the variable was tied into.

> From a language level, I'm inclined to say that any bare identifier
>that is known to be a type name should be compiled to a type object
>that stringifies to the name of its type.  Then class methods don't
>have to do an extra symbol table lookup.

None of this should really be visible from a language level except 
indirectly. (Through the overload mechanism, perhaps)

The name function for most variables would likely just return a constant 
string and, while there's some speed hit from that instead of just storing 
it in the variable somewhere, it's not likely to be called often enough to 
make a difference.

For real perl language-level method calls, I'd figure we'd cache a pointer 
to the package stash in the variable, store the hash value of the method 
name (if it's a bareword method call) in the opcode and, if the call's on a 
typed variable, a pointer to the CV for the method. (Ignored if the real 
variable's not of the type declared in the code)

                                        Dan

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

Reply via email to