On Tue, Aug 09, 2005 at 03:54:23PM -0400, Stevan Little wrote:
: 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.

And I will comment from the language point of view.

: >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).

Well, Perl 6 The Language sees "Foo" as package(Foo), actually.

: This is all, of course, implementation details.

When Perl 6 The Language sees any bare identifier, it cannot treat
it as a bareword like Perl 5 does, since Perl 6 has no barewords.
So either something in the context tells us what "Foo" means, or
it will be taken as a list operator that hasn't been declared yet.
There are various "nearby" contextualizers, such as an immediately
preceding "sub" or an immediately following "(" or "=>".  Distant
context basically comes down to declarations that influence the
langauge that is recognized at the current location, and a class
declaration is just one of those kinds of declaration.

: >Is not an object
: Nope... its magic :)

Well, hmm, except insofar as any package is an object that knows how
to be a symbol table, and and be the base class for other kinds of more
magical packages.  The magic comes into play when these various package
objects start pretending to be modules or classes or roles or subtypes.

: >  => 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 >

Yes, you're basically correct.  It's just that Perl 6 The Language
thinks that all types are "interfaces" and thus stored in various
kinds of packages, many of which have public names, though there
are also anonymous and lexical packages/modules/classes/roles/types.

: >~ 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.

>From the viewpoint of Perl 6 The Language, a class also serves as the
generic placeholder for reasoning about objects of the class in the
abstract without necessarily actually having an object of that type
to play with.  As such it's the logical invocant for constructors, as
well as other methods that want to play "what if" games on the objects
of the class without necessarily creating one.  Some of these abstract
games will naturally call into the guts of the metaclass for answers.
For example, you might ask the class an abstract question: "If I were
to ask each existing object whether it thinks it's a member of your
class, how many would say 'yes'?"  Of course, the efficient way to
answer that question is probably not to interrogate all the objects,
but just cheat somehow via the metaobject.

I kinda like Autrijus's idea that "meta" just means "guts".  In
classical Greek, "meta" just means "with".  The fancy philosophical
meaning of "aboutness" isn't there, but is a backformation from
terms such as metaphysics.  Metaphysics is just what you study along
"with" physics.

Though "guts" objects is a bit offputting.  You know, I keep mistyping
"meta" as "meat" half the time, so maybe we should make that a feature
and call them "meat" objects instead. :-)

Except that then I'd be typing "meat" as "meta" half the time...

: >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.

I'm not sure if Class is really a class or just a role containing
the interface to bootstrap a class instance using the meatclass, er,
I mean, the metaclass.  The abstract parts of a class that overlie
the package are rather, um, abstract.


Reply via email to