Constraints are applied at instance `construct`. The reasoning is that a constraint is a "constraint" that the runtime tries to uphold -- it is considered part of the construction of the object. (The run- time is careful to defer constraints on yourself until _after_ any constant initial values are installed and the construct method is called, which avoids most reference errors.)

If you need to make computations on children, you typically add an `init` method or `oninit` handler.

Can you give a specific example of what you are looking for? Maybe this is a place where the language can be improved.

On 2009-09-24, at 01:15, James Robey wrote:

I've run into several patterns recently that have been complicated esp. in SWF9 by not having a "late" constraint type, or to be clearer, $late{someobj.someattr}, where it is not first evaluated until after all inits have been completed. When a constraint's target is not present on first evaluation (causing a runtime error), the constraint will be disabled, and so a late stage (and doing the constraint by hand) is the only way to latch an object not made at init time. Really, i use this pattern alot, and in all of my programming i've never needed more then

construct
early
init
late

but those four i've needed in equal measure (with early being the least used, if anyone cares). I'm curious to know how much effort it would take to add a late stage. Anyone?

I should search JIRA, i know, i'm a bit rushed in typing this.

Thanks for anyone in the know,
James Robey

Reply via email to