develooper Front page | perl.perl5.porters | Postings from October 2011

Re: [perl #100190] RFE: fix sprintf to be consistent with printf andbe useful!

Thread Previous | Thread Next
From:
Brian Fraser
Date:
October 5, 2011 14:38
Subject:
Re: [perl #100190] RFE: fix sprintf to be consistent with printf andbe useful!
Message ID:
CA+nL+nb+s2C-Z3dxP4-vMOyCbmLRO-O4xx6pz8QM54sDK_kTmg@mail.gmail.com
On Sat, Oct 1, 2011 at 1:18 PM, Linda Walsh <perl-diddler@tlinx.org> wrote:

> [...]You CAN
> pass an array to it, it just is BAD code -- it certainly doesn't throw an
> syntax error -- it allows an array there, which, "___is [almost]^ never
> useful__".  [...]
>
>
>
You know.
That's actually true.
There's a bug in a handful of modules because of this; See
http://grep.cpan.me/?q=sprintf\s*\%28%3F\s*\%40 and
http://www.google.com/codesearch#search/&q=sprintf\s*\%28
?\s*\@%20lang:^perl$&type=cs
Changing it takes two lines of code (regen/opcodes and t/op/cproto.t) and a
regen, plus doc/delta changes. I was under the impression that @ is a
superset of $@, so there's no lost functionality either -- I'm running (a
very slow) make test right now, and nothing is failing, so this behavior
wasn't even tested for! (or I haven't reached that part yet, but
op/sprintf.t and op/sprintf2.t passed without issues)

And it's not like prototypes haven't been changed before (to tchrist's
chagrin, e.g.
http://www.nntp.perl.org/group/perl.perl5.porters/2011/04/msg171420.html).

So eh, any reason why this can't be changed? If anyone needs a compat layer,
I imagine it's trivial enough to provide through Classic::Perl/Modern::Perl,
or somesuch.

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