[Israel.pm] Followup on Gaal's talk on Class::Accessor - inside out classes.

Gaal Yahas gaal at forum2.org
Sun Feb 29 12:02:49 PST 2004

On Sun, Feb 29, 2004 at 03:55:09PM +0200, Yuval Kogman wrote:
>  I didn't think so, because the hash keys, being stringified, are not
> > hard references any more
> There's always Tie::RefHash - it works wonderfully for a hash of hard
> ref keys. And you could always make a reference out of a number (and a
> number out of a string), if you use Devel::Poiner::PP. Buit this is
> bound to be a Bad Thing(tm).

No no, weak refs are a *feature* here :) because you don't want the
class to hold extra refs to the intance -- it would never be destroyed

> > so you do get DESTROY called at the right
> > time and since you know the fields you can also delete the elements.
> But in my proposed implementation, the closure of hash per accessor, you
> can't access the hashes properly. You need to know what they are. Beh.
> It doesn't really matter.

Just to pick up the equine mortician job, you know the accessor at
creation time so you could tweak the implementation trivially to
register it somewhere nearby (a lexical would do), and have DESTROY in
the same scope. But yeah, let's not go to Camelot.

> > So I'd have said "go for it", but instead have to say "it's been done". :/
> Hmm, I should have figured. Perlmonks are obsessed with inside out
> objects. Well, most of them, anyway.
> I personally think it takes away your liberty cleaning up after someone
> elses properly done mistakes.


Gaal Yahas <gaal at forum2.org>

More information about the Perl mailing list