develooper Front page | perl.moose | Postings from March 2009

triggers and the single meta-attr object

Thread Next
From:
Hans Dieter Pearcey
Date:
March 29, 2009 02:38
Subject:
triggers and the single meta-attr object
Message ID:
20090329043226.GF3018@glaive.weftsoar.net
In December, mst committed ec2e2ee5a0f010fe09d57e0176717b6b4f5671a2, which
removes the meta-attr object as the third argument to triggers, saying

    unsupport passing meta-attr object to triggers because (a) it's not tested
    (b) it's not documented (c) it makes it impossible to not close over the
    meta-attr objects

As far as I can tell, though, it *was* documented and had been for a long time.
(Also, that commit only removed this behavior from inlined accessors and
constructors, so anyone not using make_immutable still got the meta-attr object
passed to their triggers if the constructor invoked them.)

A month later, nothingmuch merged in a big branch that reinstated the passing
of the meta-attr object to triggers in inline constructors, but I couldn't find
any comment about why this was done. (59f5bbde66d61d15b684be88d138fd798ba851d0)

Today, http://rt.cpan.org/Public/Bug/Display.html?id=44429 summarizes the
problem: writers (inline or not) invoking a trigger don't pass in the
meta-attr. Moose::Manual::Attributes document that they do and Moose document
that they don't.  There aren't tests one way or another.

We need to pick one and stick to it.  I don't want another fix (in whichever
direction) that someone else undoes a month later.

If it's "change the code to match the docs", that's done in
http://github.com/hdp/moose/commit/b0871377ee1fb633784cf69cd4d096a0c3183493

If it's "change the docs to match the code", that's easy; remove the mention of
the meta-attribute object from Moose::Manual::Attributes.

I don't know how to weigh these two concerns, though:

* It has been documented and working for as long as I can remember that
  triggers receive the meta-attr object.

* Passing the meta-attr object to triggers rules out some theoretical
  performance improvements.

(When I say it like it that, it sounds like we should change the code to match
the docs, but optimizing Moose performance is something I have no experience
with.)

hdp.

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