Hi, Yuval Kogman wrote: > On Thu, Aug 25, 2005 at 11:16:56 -0000, David Formosa (aka ? the > Platypus) wrote: >> On Wed, 24 Aug 2005 16:13:03 +0300, Yuval Kogman >> <[EMAIL PROTECTED]> wrote: >> > perl6 creates a new instance of the perl compiler (presumably an >> > object). The compiler will only compile the actual file 'foo.pl', >> > and disregard any 'require', 'use', or 'eval' statements. >> >> use has the potentional to change the way the compiler >> parses the code. So use needs to be regarded. > > Hmm... Good point. > > I don't know how this is dealt with WRT to the "every module is > compiled with it's own compiler" approach perl 6 is supposed to > have.
The indermediate form of a compiled .pm has to have a section containing information about the symbols exported by the module, similar to today's pilGlob section Pugs gives you if you use -CPIL, -CPerl5, or -CJSON: $ pugs -CPerl5 -we 'sub foo {...}' | \ perl -MYAML -we 'print Dump(eval <>)' --- !perl/PIL::Environment pilGlob: [...] - !perl/PSub pSubBody: PNil pSubLValue: 0 pSubName: '&main::foo' pSubParams: [...] pSubType: SubRoutine pilMain: !perl/PStmts pStmt: PNoop pStmts: PNil This section will contain all information needed: * User-defined operators * Other symbols exported by "is export" * Exported macros Note that *none* of these things influence the compilation of other .pls and .pms unless they're exported. I.e.: # Foo.pm module Foo { sub infix:<+> ($a, $b) { 42 } say 1 + 1; # 42 } # Exported symbols: ::Foo # test.pl use Foo; say 1 + 1; # 2 # Bar.pm module Foo { sub infix:<+> ($a, $b) is export(:DEFAULT) { 42 } say 1 + 1; # 42 } # Exported symbols: ::Foo, &infix:<+> # test.pl use Bar; say 1 + 1; # 42 --Ingo -- Linux, the choice of a GNU | We are Pentium of Borg. Division is futile. generation on a dual AMD | You will be approximated. Athlon! |