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

Re: [perl #85150] each on an anonymous array constructor doesn'tcomplain, but sorta works

Thread Previous | Thread Next
From:
David Nicol
Date:
January 3, 2012 15:59
Subject:
Re: [perl #85150] each on an anonymous array constructor doesn'tcomplain, but sorta works
Message ID:
CAFwScO8QV0w-2Hz21yo48y0oPZQqwDkoNtpVgB_T7eM7KDZH-g@mail.gmail.com
On Tue, Jan 3, 2012 at 5:47 PM, Zefram <zefram@fysh.org> wrote:
> Ricardo Signes wrote:
>>How hard is a warning here?
>
> What is the proposed scope of a warning?  What's been misunderstood
> here isn't "each", it's "while".  You could get an essentially identical
> effect from "... while pop @{[1,2,3]}" or from any other builtin or sub
> that side-effects an array or hash argument.
>
> -zefram

the warning could say "mutator used in boolean context" for instance,
and it might go off whenever a returned value gets downgraded to
true/false. Discouraging that could go a long way towards eventually
making all that "0e0" and "0but_true" a memory.

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