using weak refs and requiring 5.6
Jonathan Swartz <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
One of the optimizations I'm adding to HEAD involves caching component
objects inside other components. Every time a component foo calls a path
like <& ../bar &>, we do a bunch of work to canonicalize the path, make
it absolute, see if it is a subcomponent or method call, etc. But in
static source mode, you are guaranteed that "../bar" will always map to
the same component object, so you can create a cache entry
"../bar" => {bar component object}
inside a private component cache for foo.
However, it is important for the values in this cache to be weak
references, so that we don't create circular refs or hang onto old
versions of components.
So my questions are:
* Is Scalar::Util::weaken() stable and performant enough to use more
extensively in Mason? The docs for Perl 5.6.0 say that weak references
are still experimental, but I never found a corresponding doc to say
that they are now stable. Does the stability vary depending on Perl
version? And I saw this performance patch against 5.8 -
http://aspn.activestate.com/ASPN/Mail/Message/perl5-porters/1506613
which I didn't really understand but worried me.
* I remembered vaguely discussing that we're going to require 5.6
starting with Mason 1.3, so Scalar::Util::weaken should be available
everywhere, right? Should we require 5.6.0 or 5.6.1? I know that the
former is problematic and unstable, but lots of default setups still use
it. I don't want to leave them out in the cold unless we feel it'll be
especially unstable in conjunction with Mason and weakrefs.
Jon
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl