Day 227: I survived!

autrijus on 2005-09-21T17:47:57

Wow, I'm still alive after this tumulous week, which featured not one but three met-at-the-final-minute deadlines, a rescheduled and forced-upgraded plane ticket, my passport stuck in limbo for three days due to DHL system errors, and of course even more hardware failures.

At long last I'll be able to catch some sleep now, wake up and board the plane, step off it and sleep for a few hours, then immediately step up to speak in CUFP, with nary a page of slides in sight (or in mind). Wish me luck, as I'd need it very much...

Perl6-MetaModel News

Some re-arranging has been done, ::Object now shares pneuma.pl with ::Package and ::Module, while ::Role has been moved to the new psyche.pl file. This means that genesis.pl is concerned simply with bootstrapping things, and nothing more.

The Role work is progressing slowly becuase of $work. However, we have added pictures (p6_role_model.jpg) and there is some general thoughts/comments in psyche.pl as to how the bootstrapping will actually work.

We recently added a test which implements the inside-out style of objects within the meta-model. This basically shows that the meta model is capable of itself hosting other models.

Basic support (read: very experimental) for parameterized classes has been added recently. This is implemented entirely on the "macro" level, and not actually part of the meta-model itself. Here is an example of how it is used:

my $Scalar = class 'Scalar' => [ '::T' ] => sub {
    my %params = @_;
    my $T = $params{'::T'};
    
    $::CLASS->add_method('STORE' => ::make_method(sub {
        my ($self, $value) = @_;
        $value->isa($T->name) or die "Incorrect Type";
        # ... store the value here 
    }));
};
At this point $Scalar is not actually a Class instance, but more a Class instance factory (actually it's a CODE ref). Here is how it is used:

my $Int = class 'Int' => {};
my $ScalarInt = $Scalar->('::T' => $Int) 
Now $ScalarInt is actually an instance of Class parameterized to only accept Int objects. For a working version of this example see 32_parameterized_classes.t.


Parameterized Classes and Types

chromatic on 2005-09-21T19:14:10

Is the check for the type actually an isa() check or is it a does() check? I think it should be the latter, but I don't know if you're that far in the code yet or if anyone's banged his shoe on the desk and said "Allomorphism matters!"

*bang* *bang*

Re:Parameterized Classes and Types

Stevan on 2005-09-21T21:14:15

Ouch! stop hitting me with the shoe!

Actually that check really should be (and eventually will be) a does(), however at the time of that writing Roles were not yet complete enough to be used in that manner.

- Stevan