| Store | Cart

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

From: demerphq <deme...@gmail.com>
Thu, 23 Oct 2014 08:34:21 +0200
On 22 October 2014 06:44, Father Chrysostomos via RT <
perl...@perl.org> wrote:

> On Tue Jul 22 12:18:59 2014, demerphq wrote:> > 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.>> I see no other way for this to work.  Can we close this as not-a-bug?>>
We could remove the unnecessary prototype.

Yves


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

Recent Messages in this Thread
Eirik Berg Hanssen Oct 24, 2014 08:28 pm
Eric Brine Oct 24, 2014 07:01 pm
Father Chrysostomos via RT Oct 23, 2014 09:54 pm
demerphq Oct 24, 2014 05:34 am
demerphq Oct 23, 2014 07:23 am
Eric Brine Oct 24, 2014 12:30 pm
demerphq Oct 24, 2014 12:34 pm
Eirik Berg Hanssen Oct 24, 2014 01:23 pm
Jarkko Hietaniemi Oct 24, 2014 01:52 pm
Eirik Berg Hanssen Oct 24, 2014 02:04 pm
demerphq Oct 24, 2014 04:01 pm
Eric Brine Oct 24, 2014 05:24 pm
Eirik Berg Hanssen Oct 24, 2014 06:05 pm
Jan Dubois Oct 24, 2014 05:45 pm
Eric Brine Oct 24, 2014 06:55 pm
Eric Brine Oct 24, 2014 03:08 pm
demerphq Oct 23, 2014 06:34 am
Father Chrysostomos via RT Oct 22, 2014 04:44 am
Tony Cook via RT Oct 23, 2014 03:33 am
Messages in this thread