in reply to (Sort of) poll: what Perl6 features do you consider {likely,desirable} to leak into P5?
Macros.
B::Generate already has most (all?) of the nouce required to make macros available in Perl 5 right now. I wish I could pursuade it to build on win32.
As a very loose spec, something like this ought to work.
use Macro 'min( $x, $y )' => q[ ( $x < $y ? $x : $y ) ], 'max( $x, $y )' => q[ ( $x > $y ? $x : $y ) ], ; ... my( $p, $q, $r ) = ( 1, 2, 3); my $i = min( $p, $q ); my $j = max( $q, $r );
This can be almost done now by evaling the strings and storing a coderef in a hash, and declaring an empty sub with the macro name. Then at INIT{} time, walk the codetree looking for calls to the subs and substitute the code generated earlier for the subcalls.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: (Sort of) poll: what Perl6 features do you consider {likely,desirable} to leak into P5?
by blazar (Canon) on Mar 10, 2005 at 08:07 UTC | |
by BrowserUk (Patriarch) on Mar 10, 2005 at 08:29 UTC | |
by blazar (Canon) on Mar 10, 2005 at 09:50 UTC | |
by BrowserUk (Patriarch) on Mar 10, 2005 at 10:12 UTC | |
by dragonchild (Archbishop) on Mar 10, 2005 at 13:24 UTC | |
| |
by blazar (Canon) on Mar 10, 2005 at 13:00 UTC |