[Laszlo-dev] Construct methods and attribute predicates [Was: Didn't you report a bug about _instanceAttrs and states?]

P T Withington ptw at pobox.com
Sun Jan 11 13:15:25 PST 2009


I think André's suggestion, which I filed as LPP-7613 is a simpler  
approach than what we were trying to do in this thread.

On 2009-01-11, at 14:35EST, Henry Minsky wrote:

>>> There are likely even more aspects which make clear that  
>>> setAttribute
>>> isn't a good candidate for such stuff.
>>
>> Yes, you are exactly right here.  So, there needs to be some other  
>> interface
>> for removing a constraint on an attribute.
>>
>> It sounds like __LZhasConstraint (or something like it) should be  
>> made
>> public.  Perhaps it should return the constraint method name when an
>> attribute is constrained, so you can use removeConstraintMethod to  
>> remove
>> the constraint if you want to override it?
>
> I think that having an API to tell if a constraint exists might be the
> best solution for now.
> Question, what happens if someone has two or more different
> constraints which set the same attribute? I guess that would be an app
> design bug, no? Or at least a bad idea?
>
> If you can manually remove find and remove a constraint, and can tell
> if the user explicitly supplied an attribute value, then your class
> can decide whether to use the default constraint or override it with a
> constant value.
>
> I guess the only way to tell if an arg is supplied explicitly, is to
> use the idiom you had where the construct() method looks for the
> attribute name in the args list, e.g.,  args['x']?
>
>
>
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com




More information about the Laszlo-dev mailing list