Nick Ing-Simmons <[EMAIL PROTECTED]> writes:

> Mark Sparshatt <[EMAIL PROTECTED]> writes:
>>
>>I'm not 100% certain about the details but I think this is how it works.
>>
>>In languages like C++ objects and classes are completely seperate.
>>classes form an inheritance heirachy and objects are instances of a
>>particular class.
>>
>>However in some languages (I think that Smalltalk was the first) there's
>>the idea that everything is an object, including classes. So while an
>>object is an instance of a class, that class is an instance of another
>>class, which is called the metaclass. I don't there's anything special
>>about these classes other than the fact that their instances are also
>>classes.
>>
>>
>>Thinking about it I think you may have the relationship between
>>ParrotObject and ParrotClass the wrong way around. Since a class is an
>>object but and object isn't a class it would be better for ParrotClass
>>to inherit from ParrotObject, rather than the other way round.
>>
>>In Ruby when you create a class Foo, the Ruby interpreter automatically
>>creates a class Foo' and sets the klass attribute of Foo to point to Foo'.
>>
>>This is important since class methods of Foo are actually instance
>>methods of Foo'. Which means that method dispatch is the same whether
>>you are calling an instance of class method.
>
> So in perl5-ese when you call 
>
>    Foo->method
>
> you are actually calling sub Foo::method which is in some sense
> a "method" of the %Foo:: "stash" object.
>
> So what you suggest is as if perl5 compiled Foo->method
> into (\%Foo::)->method and the %Foo:: 'stash' was blessed...

Personally, I've always wished that Perl5 *had* done that. I've toyed
with the idea of blessing Stashes, but never got around to actually
implementing anything.


Reply via email to