[Adding laszlo-dev]

On 2009-01-11, at 07:17EST, André Bargull wrote:

On 1/11/2009 12:12 AM, P T Withington wrote:
Henry and I are floundering trying to fix LPP-7602 and I think the reason my idea doesn't work is that if there is a constraint in a class, it does not show up in _instanceAttrs, so it won't be removed by a state.

Yes, only _instanceAttrs will be removed by states. But nevertheless, I'd like to remind you on this email conversion on laszlo-dev: "http://www.openlaszlo.org/pipermail/laszlo-dev/2008-March/013658.html ". My last mail is still unanswered, it points out to an example in the doc where a constraint used to be re-enabled (but not executed!) [1] after a state was removed.

I seem to have dropped the ball there.

But, I am not comfortable with applying a constraint and not executing it. That seems like a ticking bomb. If a constraint is applied, it should be enforced, no?

So there are cases where we want constraints to "live on" after a state was applied/removed and in other cases this must not happen, just like for the debugger x-/y-constraints.

Actually, now that I think of it, maybe the bug had to do with replication? But I think it is the same issue...

Maybe you had LPP-7420 in mind? For the bugfix, I've added "__LZgetInstanceAttr" to LzReplicationManager, this methods tries to look up an attribute in the "_instanceAttrs" and if the attribute wasn't found, it tries next "node['constructor'].attributes".

Yes.

It seems like we need a general mechanism in the constructor to ask:

1) Is there an initial value for this attribute (whether from class or instance, whether constant or constraint)

This allows a constructor to decide if it should install some computed default or not, for the case where you have a computed default that is too complex to be an initial value or constraint (e.g., for the debugger, where you really need to know which of x, y, width, and height have been given instance values to decide how to initialize those that have not (in the debugger it is even more complex because you want the defaulted values constrained to a computation on the canvas dimensions and the specified values so that the defaulted values properly follow the canvas if it is resized).

and:

2) Is there a constant initial value for this attribute (whether from class or instance)

There may be cases where the constructor can make an optimization by knowing constant initial values early.

3) Finally, as Henry has suggested, if an attribute is constrained, shouldn't setAttribute remove that constraint? Is this the general mechanism that should be used to remove constraints?

Reply via email to