On 2006-06-23, at 14:02 EDT, Max Carlson wrote:

>> In basecomponent.lzx, there is this declaration
>>
>>         <event name="on_enabled"/>
>>
>>
>> The code in  the compiler NodeModel.java emits a "$immediately 
>> {null}" as
>> the init value for a "event" attribute. I am wondering
>> if it should be initialized to the same sentinel object that
>> DeclareEvent uses ?
>>
>>
>>     void addPropertyElement(Element element) {
>>         String tagName = element.getName();
>>         if (tagName.equals("method")) {
>>             addMethodElement(element);
>>         } else if (tagName.equals("handler")) {
>>             addHandlerElement(element);
>>         } else if (tagName.equals("event")) {
>>           // needed to prevent interpretation as an event handler for
>>           // schema-defined events -- setting the value to immediate
>>           // null is enough to do that
>>           // TODO: [2006-01-29 ptw] This mechanism is a little
>>           // fragile: right now ${} trumps any type, which is why  
>> this
>>           // works; but that could easily break if we enforce
>>           // types...
>>           element.setAttribute("value", "$immediately{null}");
>>           addAttributeElement(element);
>>         } else if (tagName.equals("attribute")) {
>>             addAttributeElement(element);
>>         }
>>     }
>>
>
>
> Sounds like it should definitely be initialized to the sentinel  
> array...

As the TODO says, this is a fragile area of the tag compiler stemming  
from treating an event declaration as an attribute declaration.  It  
might work to use the sentinel event instead of null, but perhaps we  
want to consider if now is the time to split events from attributes?
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to