On Thu, Feb 04, 2010 at 11:53:50AM -0800, Karen Etheridge wrote:
> On Thu, Feb 04, 2010 at 02:17:32PM -0500, Hans Dieter Pearcey wrote:
> > I'm not sure whether this is a bug or not, but we've been talking about 
> > giving
> > initializer the axe for a while.  Does anyone feel motivated by this to do 
> > so?
> 
> I'm currently using an initializer attribute in $work code, to copy values
> out of $obj->attr1 into $obj->attr2 (both are objects) when attr1 is set,
> but I'm staring at the code again now and wondering why I didn't just write
> a trigger instead.
> 
> Is there any behavioural difference between initializer and trigger methods
> that I'm missing?

Doh let me rephrase (of course they are different - trigger acts like an
'after'  method modifier on the setter, whereas initializer acts like an
'around'). Is there anything one can do with an initializer that can't be
done with a trigger?  If one wants to change the value of an attribute if a
particular value was assigned, one could simply call $attr->set_raw_value,
but that bypasses type coercion and some other nice things. Calling
set_value would cause an infinite loop in the trigger.

The only other way through this that I see is to add a new meta-attribute
method set_value_without_trigger, but that's gross!


-- 
      "If you can talk brilliantly enough about a problem, it can create
     the consoling illusion that it has been mastered." - Stanley Kubrick
            .             .            .            .             .
Karen Etheridge, ka...@etheridge.ca       GCS C+++$ USL+++$ P+++$ w--- M++
http://etheridge.ca/                      PS++ PE-- b++ DI++++ e++ h(-)

Reply via email to