Patrick R. Michaud wrote:
 >
Or, in claiming that compilers have an API, should we instead
say that the canonical compilation sequence is to use compreg
to obtain a compiler object (not an invokable sub), and then
compile the source via a 'compile' method on the compiler object?
For example:

    perl6_compiler = compreg 'Perl6'
    $P0 = perl6_compiler.'compile'(perl6_source)

Also for the record from the weekly meeting (which was actually today, just a very long today): Yes, compilers are objects and compilation is a method call. The compiler for TGE tree grammars is implemented this way, and it's a very usable interface.

We might want to resurrect the 'compile' opcode as an indirect syntax for making the 'compile' method call.

In asking the above questions I'm purposely avoiding, because Parrot
doesn't seem to support it yet, the possibility that the object
obtained via compreg is both invokable in its own right (like a sub)
and has methods attached to it.

Possible, but agreed that it's more complex than we need, without enough added gain to be worth it.

Allison

Reply via email to