Stuart,
On Aug 9, 2005, at 9:25 AM, Stuart Cook wrote:
Stevan,
Up until today, I thought I had a good idea of how your metamodel
works, but now I'm confused. My main sticking point is that a class
Foo seems to have three different aspects:
Foo
class(Foo)
meta(Foo)
For each of these, could you please try to explain:
1) Roughly what its responsibility is (and how it relates to the
others)
2) Whether it is actually an object
3) If so, what its class is
I will simply add to your explanations below (the are mostly correct).
Keep in mind, as I said to TSa, I am coming from a implementation point
of view, and so much of what I descibe will be about the
implementation.
I realise that some of these details are probably spread around
Synopses, source code, and the inside of your own head, but it would
really help to have a concise, clear definition of each.
Yes, sorry. This is why I am trying to document it now.
So far, this is what I have picked up; some/most of it is probably
wrong:
~ Foo ~
Is a type that variables etc. can be declared to have
That is one way to look at it I suppose. The reality is that there will
be no actual 'Foo', at least not in the metamodel. 'Foo' is a magical
interpreter concept, which is really just an
alias/pointer/level-of-indirection/whatever for class(Foo).
This is all, of course, implementation details.
Is not an object
Nope... its magic :)
=> I'm really not sure about this...
ahh, but you were correct. Trust your instincts Stuart < the force is
strong with this one I think >
~ class(Foo) ~
Used as the invocant of class methods
Yes. It is also the connection between the concrete instance and
concrete metaclass instance.
=> Any other purpose?
In autrijus's version of the model it also stores the index of the
attribute in the instance storage array. But other than that, no it has
no other purpose in my eyes.
Is an object; instance of the 'Class' class
Perl6::Class in the p5 metamodel. I also find adding either the Perl6::
or just :: at the front of names like 'Class' are helpful.
=> How do we get properly-typed access to members that class(Foo) has
that aren't declared in 'Class'?
class(Foo) instance methods will be for 'Foo', and the class methods
will be for ::Class.
The current metamodel hacks this in a kind of ugly way, but that is how
I am seeing it.
~ meta(Foo) ~
Members contain info /about/ Foo, rather than /of/ Foo
Yes, the metaclass basically stores the name, version, authority,
superclass list, private method table, public method table and
attribute list. All the things which make up a class (yes, I am
fluffing the details here a bit, but you get the idea).
=> This is to avoid name-clashes with 'name', 'authority' etc.
That is not really the reason, but yes it does mean that there are no
restrictions placed on class methods for 'Foo'.
Is an object; instance of the 'MetaClass' class
Yes sir. That is correct.
All in all Stuart, you were pretty much right on.
Stevan
Thanks,
Stuart