On Mon, Nov 26, 2007 at 11:29:23AM +0200, Allison Randal wrote:
> So this doesn't get Warnocked: this is a Patrick question. Best to put 
> it in the RT queue.

I'll go ahead and answer it here, now that I have an answer.  :-)

> >In my reading through the PDDs, I came across the new PAST one, which I'm
> >happy to see. I noticed that there is not any class and role definition
> >related PAST nodes. I don't know if that's by design or just because
> >nobody has written a spec and implementation yet. I think that since many
> >languages have such OO constructs, it would be a Good Thing to get PAST to
> >do some of the work.

Actually, after adding class/method support to NQP yesterday I 
think I've concluded that PAST doesn't really need new node 
types to support this, it just needed a couple of additional 
attributes on existing types [1].

My goal for PAST-pm was to take care of the things that were common 
to a bunch of languages (e.g., short-circuiting ops), and then let 
each language take care of the things that are somewhat special to
the language.  Given that so many languages have differing 
interpretations of various OO constructs and OO metamodels, for now
I think it's perhaps better if PAST gives only a little support and 
lets language-specific OO stuff be in the "things that are special" 
group.

Also, since interacting with Parrot's OO model is now primarily 
done via methods on class objects and protoobjects, PAST's "callmethod" 
op seems to be able to handle most of the work.

Of course, if we later discover that additional PAST node types 
would be useful for a wide variety of languages, we can add them.  
Thus far in looking at NQP, perl6, and pynie, I think I'm slightly
more comfortable with the existing types and a somewhat simpler PAST
implementation.

So, for now, I've added a "method" blocktype for PAST::Block
nodes to the spec, and I'm thinking that instance attributes will
end up being handled with an "attribute" scope in the PAST::Var
nodes.  

Thanks!

Pm

1.  At the moment I'm a bit biased towards having fewer PAST node 
    classes with attributes to distinguish "subtypes".  When building 
    an ast I'm finding it's much easier to change an attribute on an 
    existing node than it would be to try to copy or rebless a node 
    into a different subclass.  Likewise, the POST generation also
    seems to be slightly easier with fewer node types and some
    judicious use of attributes and MMD as method selectors.


Reply via email to