develooper Front page | perl.perl5.porters | Postings from August 2010

Re: [perl #76756] PATCH: srand returns the seed

Thread Previous | Thread Next
Nicholas Clark
August 2, 2010 07:44
Re: [perl #76756] PATCH: srand returns the seed
Message ID:
On Mon, Aug 02, 2010 at 03:41:21PM +0100, Zefram wrote:
> Nicholas Clark wrote:
> >I can see one potential crafty way to avoid the above inconsistency, which
> >is to change sv_2pv_flags() so that it doesnt (completely) cache the string
> >conversion for -0.
> Eww.  This would violate the truth value rule, by having something that
> stringifies as "-0" but is false.  Don't do it.

And so we go full circle, as you removed the code demonstrating that we
already have that bug, only worse:

$ perl -wle '$a = 0/-1; print $a ? "T" : "F"; print $a; print $a ? "T" : "F"'

because we already have it that something that stringifies as -0 may or may not
be false depending on side effects of reading it.

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About