I knew facet was a bad name for them. But here’s an explanation:

It’s a way of making one object contain another with a weak reference, specified from the containee’s side. So we have:

    class Drawer
    does Facetable
        void draw() { for i in facets { i.draw(); } }
    Drawer drawer = Drawer.new;

    class Ball
    does Drawable
        facet void drawer.draw() { /* Draw a circle */ }

    drawer.draw();   // Draws nothing
    Ball ball1 = Ball.new;
    drawer.draw();   // Draws a ball
    ball1 = 0;
    drawer.draw();   // Draws nothing again

few details I need to flesh out, like what if you want to specifiy a different “drawer” in the constructor, or something? But it seems like a powerful construct so far.

Maybe I should call them task, except that seems to have a relation to threads. Maybe favor; that might be too cutesy, though.

In related news, I’m already about half way done with the parser for this language, and the code generator should be pretty easy (considering most of what it outputs is just what it was given). I have yet to do classes and templates. I’m inclined to punt on templates because they’re a pain to implement, but I really want to be able to use existing template classes in GLIC code.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s