| Store | Cart

Re: [perl #122351] srand(()) weirdness (note the empty list)

From: demerphq <deme...@gmail.com>
Tue, 22 Jul 2014 21:18:38 +0200
On 22 July 2014 21:14, Eric Brine <ikeg...@adaelis.com> wrote:

> On Mon, Jul 21, 2014 at 12:08 PM, demerphq <deme...@gmail.com> wrote:>>> The part I consider the most serious bug is that srand(()) or sleep(())>> are treated the same as srand(undef) or sleep(undef). That is an empty>> list, it should not be treated as a value.>>>> >perl -E"say prototype 'CORE::sleep'"> ;$>> It's Perl's stupid prototypes. ($) means "one argument evaluated in scalar> context", so (;$) means "no arguments or one evaluated in scalar context".>> >perl -E"sub x(;$) { say 0+@_; } x(());"> 1>> A stub in scalar context is undef.>> >perl -MDevel::Peek -e"$x = (); Dump($x);"> SV = NULL(0x0) at 0x229240>   REFCNT = 1>   FLAGS = ()>>
Interesting. Thanks. That does make sense, in a sad way.

Cheers,
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Recent Messages in this Thread
yves orton (via RT) Jul 21, 2014 08:27 am
Dr.Ruud Jul 21, 2014 01:30 pm
Dave Mitchell Jul 21, 2014 03:46 pm
demerphq Jul 21, 2014 04:08 pm
Eric Brine Jul 22, 2014 07:14 pm
demerphq Jul 22, 2014 07:18 pm
Ricardo Signes Jul 25, 2014 11:24 pm
bulk88 via RT Jul 21, 2014 08:47 pm
Messages in this thread