On Wed, Jul 12, 2006 at 10:25:43AM -0700, Allison Randal wrote:
> It occurs to me, after thinking about it overnight, that the .loadlib
> directive shouldn't operate at :immediate time, but at :init time,
> because it's more common to want a library to load when you run the code
> than to load only when you compile the code.
Well, there was already one very legitimate usage of compile time
loadlib, which is now using C<.loadlib> for that:
.loadlib "opcode_lib"
The library is needed immediately in the compiler to be able to
proceed parsing (e.g. to check the amount and types of freshly loaded
opcodes). There was a crude hack that accomplished this, which is now
removed, because it's cleanly covered by C<.loadlib>.
See also t/dynoplibs/*.t
Another usage of compile time C<.loadlib> could be:
.loadlib "my_pmcs"
...
$P0 = new .MyInt
I.e. some custom PMC loading, w/o defining a HLL language.
There might be other cases, where :init time is early enough, though.
> Allison
leo