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

OP_ANONCODE and diagnostic messages

Thread Next
From:
Felipe Gasper
Date:
November 10, 2022 14:14
Subject:
OP_ANONCODE and diagnostic messages
Message ID:
993F6A82-EAA0-4718-A23C-4589402B2254@felipegasper.com
Hi all,

	Sometime back I merged a change to make `sub {}` parse to OP_ANONCODE rather than OP_SREFGEN/OP_ANONCODE. There’s been some CPAN breakage from this change, documented here: https://github.com/Perl/perl5/issues/20384

	Paul graciously fixed some of the breakage. I have a PR pending that I think addresses the rest: https://github.com/Perl/perl5/pull/20462

	That PR, however, will still leave at least 2 CPAN modules broken because, as a side-effect of my original change, OP_DESC for a coderef will now be “anonymous subroutine” rather than “single ref constructor”. For example:

-----
> perl5.34 -w -e 'sub {}'
Useless use of single ref constructor in void context at -e line 1.

> bleadperl -w -e 'sub {}'
Useless use of anonymous subroutine in void context at -e line 1.
-----

	In my opinion the latter is an improvement; however, those CPAN modules--I think there are 2--that expect the former in their tests would need updates.

	Is this an acceptable behaviour change?

cheers,
-Felipe

p.s. That PR could use another round of review, if someone has the chance. Thank you!

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