develooper Front page | perl.perl5.porters | Postings from January 2012

Re: defined(@arr), defined (%hash)

Thread Previous | Thread Next
From:
Eirik Berg Hanssen
Date:
January 3, 2012 08:51
Subject:
Re: defined(@arr), defined (%hash)
Message ID:
CAHAeAG4O8v=SVokPAR1eWAzr5WrBV7m95A_Rcts8WuYLy5brxg@mail.gmail.com
On Tue, Jan 3, 2012 at 3:15 PM, Nicholas Clark <nick@ccl4.org> wrote:

> On Tue, Jan 03, 2012 at 09:08:35AM -0500, Matthew Horsfall (alh) wrote:
> > Though I'm not sure honestly why defined(() = ...) even makes sense;
> seems
> > like that should be its own warning...
>
> I can't see any sense for it. I think it can only tell you something
> implementation dependent about temporary internal storage. Which, obviously
> is something essential to know about, and never a mistake.
>

  Now, I'm more of a language guy than an internals guy, but I imagine it
will tell you the Truth – or else surprise people.

  Defined imposes scalar context, and list assignment in scalar context
"returns the number of elements produced by the expression on the right
hand side of the assignment."

  Unless you are proposing to change either of, C< defined(()=...) > should
return whether this number is defined.

  I cannot quite fathom how the number of elements produced could be
undefined, so it looks like that return value will be  a universal Truth.


Eirik

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