On Sat, Feb 18, 2012 at 4:11 AM, Nicholas Clark <nick@ccl4.org> wrote:
> On Fri, Feb 17, 2012 at 10:18:57PM -0600, Reini Urban wrote:
>
>> I proposed exists to clarify the meaning against the abuse of
>> defined() to test for defined'ness and to help the language.
>
> Perl, abusing defined since 1989:
>
> $ ./perl -e 'sub def {print defined $a ? "Yes\n" : "No\n";}' -e '&def(); $a = "$]\n"; &def();'
> No
> Yes
Nonsense. defined for a global SCALAR never was in discussion. In
discussion was the meaning for defined with ARRAY, HASH and esp. CODE.
People use defined ARRAY for the existence of the array, not if it's empty.
defined(&code) is widely used because it just happens to work.
And for consistency I added lexicals to the mix.
--
Reini
Thread Previous
|
Thread Next