kurila14delta - what is new for Perl Kurila 1.4
This document describes differences between Perl Kurila 1.3 and Perl Kurila 1.4
Perl Kurila 1.4 is release for one experimental new feature: "compilation subroutines".
Compilation subroutines are lexically scoped keywords with perl sub attached to it which gets called during compile time. When the keyword is used the arguments to it are normally parsed, but after that the perl sub attached to the keyword is called with as argument the argument of its keyword as opcode tree. The sub returns an opcode tree. Thus the sub receive an opcode tree, and returns a opcode tree.
Examples of things which can be done using compile subroutines:
debuglog Data::Dumper-Dump($x)> would only execute Dump when a debug flag is set.
debuglog Data::Dumper-
str_expand 'value', would do the string expansion only once, at compile time, and give an compile time constant string.
str_expand 'value'
getparams 'foo', 'bar', { @_ } would generate the lexical vars $foo and $bar which gets initialized to the has value of { @_ }.
getparams 'foo', 'bar', { @_ }
See compsub for more information about writing compilation subroutines.
Compilation subroutines are meant mainly as a replacement for source filters and indirect object syntax, as a new method of creating new semantics. I consider its main advantage the clear syntax in combination with being lexically scoped.
To make it possible to generate new optree B::Generate has been integrated into B::OP
I am not exactly sure about the current place of recognizing the compilation sub, maybe it should should the same priority as a keyword.
The decision to not recognize the parentheses after the compilation sub (i.e. foo($arg1), $arg2 being understood as foo $arg1, $arg2. But I am temped to make this also the default for function calls. Perl Kurila 1.3 tries to reduce some ambiguities in Perl code, and to simplify the perl internals. Some uncommon and error prone options have been removed. More specific:
foo($arg1), $arg2
foo $arg1, $arg2
Generates correct optrees is very difficult. To have utility functions for some of the standard compile time actions would mostly resolve this. Of course it probably will remain difficult it you want to do very complex things.
I now use compilation sub to refer to calling the sub, but probably should be terminology making a better distinction between the word being lexical scoped and the subroutine attached to that word.
Documentation has not been updated for many of the changes for kurila.
Perl Kurila has only been tested/build for x86_64-linux-gnu-thread-multi platform.
The INSTALL file for how to build Perl Kurila.
The README file for general stuff.
The Artistic and Copying files for copyright information.
Written by Gerard Goossen <gerard@tty.nl>.
To install kurila, copy and paste the appropriate command in to your terminal.
cpanm
cpanm kurila
CPAN shell
perl -MCPAN -e shell install kurila
For more information on module installation, please visit the detailed CPAN module installation guide.