develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33995 - branches/rakudoreg/languages/perl6/src/parser

From:
jonathan
Date:
December 16, 2008 15:43
Subject:
[svn:parrot] r33995 - branches/rakudoreg/languages/perl6/src/parser
Message ID:
20081216234319.1C7C4CBA12@x12.develooper.com
Author: jonathan
Date: Tue Dec 16 15:43:18 2008
New Revision: 33995

Modified:
   branches/rakudoreg/languages/perl6/src/parser/actions.pm

Log:
[rakudo] Make use happen at compile time, but keep emitting the same thing we did before at runtime (basically, just uncomment the two lines that I'd annotated 'we really want to be doing this' and leave what we were already doing in place. Duh. :-)

Modified: branches/rakudoreg/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rakudoreg/languages/perl6/src/parser/actions.pm	(original)
+++ branches/rakudoreg/languages/perl6/src/parser/actions.pm	Tue Dec 16 15:43:18 2008
@@ -404,15 +404,13 @@
             :node( $/ )
         );
 
-        # What we'd really like to do now is something like:
-        # my $sub := PAST::Compiler.compile( $past );
-        # $sub();
-        # Which would include it at compile time. But for now, that breaks
-        # pre-compiled PIR modules (we'd also need to emit something to load
-        # modules from the pre-compiled PIR, somehow). But we can't just emit
-        # a call straight into the output code, because then we load the
-        # module too late to inherit from any classes in it. So for now we
-        # stick the use call into $?INIT.
+        # Compile the module.
+        my $sub := PAST::Compiler.compile( $past );
+        $sub();
+        
+        # Code to use the module needs to be emitted to, so this works for
+        # pre-compiled modules (it will check %*INC and not reload it) in the
+        # case we're doing a compile-and-run-directly invocation.
         our $?INIT;
         unless defined($?INIT) {
             $?INIT := PAST::Block.new();



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About