3 ms·
Well, I'm just learning Perl (work related) and it certainly feels like they tried to include a lot of ready-to-use lisp-like macros in an otherwise traditional
by Shorel 17y ago
Well, I'm just learning Perl (work related) and it certainly feels like they tried to include a lot of ready-to-use lisp-like macros in an otherwise traditional syntax when inventing Perl.
And Perl 5.12 has this jewel in its changelog:
New experimental APIs allow developers to extend Perl with "pluggable" keywords and syntax.
- draegtun 17y agoWith Perl 5.12 comes a working test example already using the pluggable feature: http://search.cpan.org/dist/perl/ext/XS-APItest-KeywordRPN/KeywordRPN.pm http://search.cpan.org/dist/perl/ext/XS-APItest-KeywordRPN/K... Here is the code example from the docs: use XS::APItest::KeywordRPN qw(rpn calcrpn); $triangle = rpn($n $n 1 + * 2 /); calcrpn $triangle { $n $n 1 + * 2 / }
- mst 17y agoWhich is already doable from CPAN using Devel::Declare, hence Method::Signatures::Simple, Sub::Curried, MooseX::Method::Signatures etc. The stuff in core is, however, way, way more elegant than the way Devel::Declare currently does it - which was rather the point, Devel::Declare was "retrofit to existing perl5 VMs what will hopefully be core later".