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

Re: OP_ANONCODE and diagnostic messages

Thread Previous
From:
demerphq
Date:
November 10, 2022 15:41
Subject:
Re: OP_ANONCODE and diagnostic messages
Message ID:
CANgJU+W-kGUBQzx436+hX0Z9bC4Sje1A_mjGrjR8K+h30G_N3A@mail.gmail.com
On Thu, 10 Nov 2022, 15:14 Felipe Gasper, <felipe@felipegasper.com> wrote:

> 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?
>

IMO Yes. Normally we try hard to provide fixup patches for things like
this, but it is inevitable fallout of improving diagnostics.

Yves

>

Thread Previous


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