develooper Front page | perl.perl5.porters | Postings from October 2014

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

Thread Previous
From:
Father Chrysostomos via RT
Date:
October 22, 2014 04:44
Subject:
[perl #122351] srand(()) weirdness (note the empty list)
Message ID:
rt-4.0.18-10170-1413953052-1946.122351-15-0@perl.org
On Tue Jul 22 12:18:59 2014, demerphq wrote:
> On 22 July 2014 21:14, Eric Brine <ikegami@adaelis.com> wrote:
> 
> > On Mon, Jul 21, 2014 at 12:08 PM, demerphq <demerphq@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?

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122351

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About