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:42
Subject:
Re: [perl #85150] each on an anonymous array constructor doesn'tcomplain, but sorta works
Message ID:
CAFwScO_vxDUokRfeTMO=_vAkUdOonTmbocrvnT4StedvUuXaZA@mail.gmail.com
each(X) is almost always a mistake when X is built fresh each time
each(X) is invoked -- it might make sense when we know that X will be
either a hashref or an arrayref but not which and we want the first
elt if its an array or some random pair when it's a hashref; that's
highly contrived and would not be clear at all. So reference-counting
the argument could be good grounds for the warning, unless that
produce a lot of false warnings without reference-counting the stack.
Automatic dereferencing is not the issue here, it's the failure of the
object of the each method to persist between invocations.

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