On Thu, Aug 18, 2005 at 04:51:58PM +0200, Leopold Toetsch wrote: > There was some recent discussion [1] [2] on p6l about BEGIN blocks and > constant, which is executed at compile time too. > > Parrot has since quite a time the @IMMEDIATE subroutine pragma, which > causes execution of subs during compilation.
You mean, during PIR compilation? > As PMC constants are already represented as frozen images in PBC this > would work for nested data strucuters, objects, and their classes too. > > Comments welcome, I think it's interesting, but as BEGIN blocks may affect subsequent parsing, as well as trigger compilation of other source files, I wonder how to address this. Hmm. Also I wonder about scoping issues: { my $a = $a / 2; BEGIN { $a = 10 }; } say $a; # this should to print 5 How is @IMMEDIATE going to handle this? Thanks, /Autrijus/
pgpcvuMn4K7uB.pgp
Description: PGP signature