joshtynjala edited a comment on issue #152:
URL: https://github.com/apache/royale-compiler/issues/152#issuecomment-708661904


   I think that both compilers are behaving correctly, and we should not change 
this.
   
   Consider the following example, which I think helps to demonstrate why 
making any changes here would be problematic.
   
   ```as3
   public static function NotMetadata(value:String):int {
        return 0;
   }
   
   public static const MY_ARRAY:Array = [1, 2, 3];
   
   public static const RESULT:int = MY_ARRAY[NotMetadata("foobar")]
   ```
   
   This code unambigiously uses array access and calls a static function, named 
NotMetadata.
   
   However, ActionScript allows us to add some whitespace between MY_ARRAY and 
the [ character, like in the next example below:
   
   ```as3
   public static const RESULT:int = MY_ARRAY
   
   [NotMetadata("foobar")]
   ```
   
   The whitespace should not change the resulting syntax tree. It's still the 
same code. Just formatted differently.
   
   The same is true if we use Bindable instead of NotMetadata.
   
   We shouldn't treat certain metadata (like Bindable) as a special case 
because ActionScript allows developers to invent arbitrary new metadata with 
any name that they want. They'll expect their custom metadata to behave the 
same, but we cannot guarantee that without breaking valid code, like what I 
included in my previous example.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to