develooper Front page | perl.module-authors | Postings from November 2003

Re: Class::FakeAttributes -- Opinions Wanted

Thread Previous | Thread Next
A. Pagaltzis
November 6, 2003 08:59
Re: Class::FakeAttributes -- Opinions Wanted
Message ID:
* <> [2003-11-04 12:30]:
> I'm guessing you didn't read my code because it was based on
> Yves'. Yves showed a single accessor method called inside_out,
> you complained that it would requir lots of typing of refaddr
> to use that for every attribute in the class so I gave an
> out-of-band accessor method _maker_.

Read it too. My point is that the method would be accessible from
a much broader scope (ie globally, really) than would the
attribute hash in Yves' code (stricly local to the method).

> > I guess you can reduce the accessibility of the attribute by
> > storing the closure ref in a lexical scoped like %attrib in
> > the above code instead of exporting it to a named sub.
> Since the exported closure was the only thing that let you
> access %attrib, putting it inside %attrib rather than exporting
> it would definitely reduce the accessibility of the attribute
> :-)

I'm not interested in where the attribute is stored. I'm talking
about the attribute. Whether it is accessed by hash lookup or
closure call makes no difference. In Yves' code, the attribute is
only accessible to the method in its scope (by looking it up in
the lexically scoped hash), while using your code, the attribute
would be accessible globally (by calling the exported function).

As I said, I was belabouring a minor point. Nevertheless, it's
important to remember all of the fine points IMHO.

"If you can't laugh at yourself, you don't take life seriously enough."

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About