[Laszlo-dev] What's the story for overriding setters?

P T Withington ptw at pobox.com
Tue Apr 22 19:01:49 PDT 2008


The name $lzc$set_x is only meant for internal consumption.  I would  
like the tag compiler to accept this:

<method name="set x" ...>

which is like what JS2 will do, and translate that to the internal  
name (and eventually straight through to JS2).  As a temporary work- 
around you can override the funny internal name.

I guess we should make an API proposal change.

There never has been a formal way to override setters.  In the past is  
was just a convention to name your method setX.  To make it a setter,  
you still had to say:

<attribute name="x" setter="setX(x)" />

right?  So the new way will let you define the setter (and override  
it) directly, without the need for the intermediate method.

On 2008-04-22, at 19:41 EDT, Max Carlson wrote:

> I know we're moving towards using setters everywhere they're  
> available, e.g. setX() will be replaced by $lzc$set_x().  This  
> breaks a use case where someone may want to override the behavior of  
> a setter, e.g.
>
> function setX(x) {
>  // limit x placement;
>  if (x < 0) x = 0;
>  super.setX(x);
> }
>
> Do we plan to support this, perhaps by keeping named setter methods  
> that can be overridden?
> -- 
> Regards,
> Max Carlson
> OpenLaszlo.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080422/793a1868/attachment.html


More information about the Laszlo-dev mailing list