Q: Is there a compiler/language/magic registry?

Austin Hastings Austin_Hastings at Yahoo.com
Wed Jul 1 15:19:43 UTC 2009

Given that loading a foreign module, or foreign source code, should be 
done by asking the compiler of the source code to do whatever-it-wants, 
is there some kind of system for knowing who to ask?

That is, if I try to load a .pbc file, will parrot automatically invoke 
the compiler that built the pbc file? Should the pbc contain a :load sub 
that invokes it?
If I try to load a source file, is there an extension->language mapping 
that tells me, or parrot, what compiler to request?
Should there be one? Tene's foreign-code-loader assumes that the 
developer knows the language of origin for each foreign module:

  use Foo::Bar:from<Tcl>;

But that's a non-starter in the long term, since knowing the language of 
implementation totally violates encapsulation.
We can't use "magic" to do this, since the pbc files have their own 
magic. But is there, or should there be, some kind of compiler record or 
annotation in the pbc? I note that the HLL setting may not be entirely 
reliable, since e.g., Close can specify whatever HLL you want to use. 
However, it seems reasonable that if Close is going to masquerade as 
Tcl, it should generate pbc that is Tcl-compliant, at least at the 
language level. So maybe the HLL is enough?



More information about the parrot-dev mailing list