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

Re: Another overdue deprecation (Also: Deprecate ' as a package separator)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
October 15, 2009 01:50
Subject:
Re: Another overdue deprecation (Also: Deprecate ' as a package separator)
Message ID:
20091015085027.GF60303@plum.flirble.org
On Thu, Oct 15, 2009 at 09:40:44AM +0100, Nicholas Clark wrote:

> Why *not* deprecate defined(%hash)?
> It does nothing that scalar %hash doesn't do.
> 
> Historically it was used because of a quirk of the implementation - it would
> report on whether space had ever been allocated for the hash. So it would
> become true when the first key was created (or space for it reserved), and
> would remain true if all the keys were deleted. It would only become false
> if undef %hash was used to free up the space.
> 
> Right now there's a hack in toke.c to help support defined %hash, for the
> specific intended use of defined %some::stash::
> 
> The intent is "was this package loaded?". I can't see any use case where
> "did this package define any symbols?" differs.
> 
> I'd like to get rid of hacks.

Actually, I suspect that it was also an anti-pattern, because in scalar
context it used to be that C<defined %hash> was faster than C<%hash>

Yves fixed that some years ago.

Nicholas Clark

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