[Laszlo-dev] Syntactic sugar

André Bargull andre.bargull at udo.edu
Wed Dec 3 13:41:44 PST 2008


Yes.

On 12/3/2008 9:56 PM, Henry Minsky wrote:
> Is IE7 the only runtime platform that we support now that does not
> have setters ?
> 
> 
> 
> On Wed, Dec 3, 2008 at 3:27 PM, André Bargull <andre.bargull at udo.edu> wrote:
>> If we had (native) setters in all runtimes, things would be much easier.
>> I've you add an alias for "setAttribute", I'd like to remind you on the
>> current limitation of the "setAttribute" inline compiler:
>>> // FIXME: [2002-12-03 ptw] This substitution is not correct
>>> // because it does not verify that the method being inlined is
>>> // actually LzNode.setAttribute.
>> So any new alias (let's say "set(..)") will be restricted to the same
>> limitation.
>>
>> And there is another issue which comes to my mind: in my opinion, it's not
>> only the longer method name ("setAttribute" instead of "setX"), but also the
>> whole function call with attribute-name in quotes + value. Just as an idea,
>> what about adding a new syntax? (I do know adding a non-ECMAScript syntax
>> may be harmful..)
>> For example to set the "x"-attribute to "10" on a view "v":
>>  set v.x = 10;
>>
>>
>>
>>
>>> I'd like to replace:
>>>
>>>   v.setAttribute('x', ...);
>>>
>>> with:
>>>
>>>   v.x = ...;
>>>
>>> someday.  Having an alias `set` for `setAttribute` would be a fine
>>>  interim step.
>>>
>>> On 2008-12-03, at 00:45EST, Max Carlson wrote:
>>>
>>>> / I've had a number of developers tell me they miss the shorthand of  />/
>>>> setX(...) - 4.2 now requires setAttribute('x', ...).  This is good  />/ for
>>>> consistency, but it's bad for backward compatibility and makes  />/ code
>>>> more verbose.  setAttribute('foo', ...) requires a lot of extra  />/
>>>> typing...
>>> />/
>>> />/ What do you think about having the compiler expand the old setX/Y()
>>>  />/ methods into the corresponding setAttribute('x/y')?  We could add a
>>>  />/ terse alias for setAttribute() - set(), or maybe s()...
>>> />/
>>> />/ Thoughts?
>>> />/ -- />/ Regards,
>>> />/ Max Carlson
>>> />/ OpenLaszlo.org
>>> /
> 
> 
> 



More information about the Laszlo-dev mailing list