Front page | perl.perl5.porters |
Postings from May 2010
Re: *foo{SCALAR}
Thread Previous
From:
demerphq
Date:
May 3, 2010 02:06
Subject:
Re: *foo{SCALAR}
Message ID:
g2w9b18b3111005030206q2f6f597p50801a6954c298e2@mail.gmail.com
On 30 April 2010 23:25, Zefram <zefram@fysh.org> wrote:
> Nicholas Clark wrote:
>>I don't see the existing behaviour as a bug. It was quite deliberate.
>
> OK, it's not a bug. It's still surprising.
>
>>That doesn't mean that behaviour shouldn't change. But it's a change of
>>behaviour, not a bug fix. And it will break some existing code.
>
> I think it should change. Distinguishing between "variable by this
> name never referenced" and "variable by this name used and has default
> value" seems as useful for scalars as for arrays, hashes, and subs.
> I have a specific use case where the distinction is vitally important:
> Lexical::Import. It would be generally useful to anything walking the
> package for debugging or other introspective use.
>
> As for breakage, note that I only advocate changing the glob deref
> operator "*foo{SCALAR}", not anything else that looks at GvSV. So this
> won't break code using arbitrary operators that implicitly reference
> uninitialised scalars. It'll only break code that explicitly retrieves
> *foo{SCALAR} and assumes that this is defined. A non-zero amount of
> code, but small, and updating all that code seems a price worth paying
> for the added power and consistency.
FYI: There is code in DD specifically for this case. Id expect any
capable data serializer to somewhat affected by this change.
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"
Thread Previous