develooper Front page | perl.perl5.porters | Postings from July 2012

Re: What would having a & prototype after the first position break?

From:
Father Chrysostomos
Date:
July 29, 2012 16:20
Subject:
Re: What would having a & prototype after the first position break?
Message ID:
4A439559-4992-48A4-A1B4-0D2BDF76C971@cpan.org
Chris Nehren wrote:
> I'm fine with doing the work to add this feature. I would just like to
> be sure I don't break half of CPAN with my efforts.
> 
> Thoughts? Comments? Rallying praise? Rotten tomatoes?

I like the idea.  Implementing it may be complex, because the parser (perly.y) has a special branch of its listop rule for this case (search for LSTOPSUB).  To allow (&&), ($&), (&$&$), and all other variations would need infinite parser rules, if the current approach were to be used.  So that could never work.  Instead, the lexer (toke.c; search for PREBLOCK(LSTOPSUB)) would have to invent commas to feed to the parser.  You might need to add new possible values for PL_expect.  For an example of remembering what type of block we are in, see the last few commits on the sprout/overridesĪµ branch, particularly ae8d0518822.




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