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 ClarkThread Previous | Thread Next