Aaron Sherman writes:
> But according to A12 as I understand it, the part BEFORE that, which
> looked innocently like a definition:
> 
>       class Joe { my $.a; method b {...} }
> 
> would actually get turned into a BEGIN block that executes the body of
> the class definition as a closure in class MetaClass and stores the
> result into a new object (named "Joe") of class Class.
> 
> Perl 6's compiler does not (by default, at least) know how to run code.
There's where you're wrong.  In the static languages world, they like to
make the target architicture independent of the compiler's architecture.
C++ does this (and runs into rather a problem doing so, because of the
treatment of templates).

But Perl 6 is tightly coupled with Parrot.  Perl 6 will be a Parrot
program (even if it calls out to C a lot), and can therefore use the
compreg opcodes.  That means that any code executing in Parrot can call
back out to the Perl 6 compiler, and obviously the Perl 6 compiler can
call out to parrot.

So:

      eval "eval 'eval 1'";
    #(a    (b    (c     )) )

Goes through this process:

    Perl 6 compiles (a)
        Perl 6 tells Parrot to run (a)
            Parrot calls out to Perl 6 to compile (b)
                Perl 6 tells Parrot to run (b)
                    Parrot call out to Perl 6 to compile (c)
                        Perl 6 tells Parrot to run (c)
                        The result is 1
                The result is 1
        The result is 1
        ...

Luke

Reply via email to