develooper Front page | perl.perl5.porters | Postings from November 2017

Re: square signatures

Thread Previous | Thread Next
From:
David Nicol
Date:
November 20, 2017 17:33
Subject:
Re: square signatures
Message ID:
CAFwScO_6vsPvBOmdC-sTUZvPQkJPsnvHWxvvt-UDToqEG23fUA@mail.gmail.com
My unusual opinion on this matter continues to be that instead of providing
a signatures syntax, it would be better to provide a macro syntax that is
capable of defining a signature syntax.

The result would be a situation where a subroutine definition with a
signature would use a new macro keyword rather than trying to make C<sub>
do even more things based on how it gets punctuated, in perl's grammar.

The "Macrame" work I was working on until I stopped working on it was
supposed to make it possible to do something like (I haven't looked at that
code in years and am re-envisioning here)

#<<< no tidy
    MACRO sigsub [ M@1 ] { EXPANDS TO 'sub {  my (M@1) = @_;'; # no need to
quote whatever is betwen MACRO and EXPANDS TO because MACRO seized the
input stream and M@n means
#>>> resume balancing curlies

This might be possible now with parse-time hooks attached to the sub
keyword. Anyway, easier parse-time hooks for fine-grained and hygenic
source rewriting that leaves literals the hell alone (which AIUI is the
biggest problem with source filters, especially as Filter::Simple *almost*
got it right, but could be easily fooled.)



-- 
Hi-jinks ensue.

Thread Previous | Thread Next


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