On 2010-03-14, at 12:20, P T Withington wrote:

> On 2010-03-14, at 11:25, André Bargull wrote:
> 
>> 
>> On 3/14/2010 3:05 PM, P T Withington wrote:
>>> On 2010-03-13, at 20:47, André Bargull wrote:
>>> 
>>> 
> [...]
>>>> I wonder why the compiler wraps a simple function declaration outside of a 
>>>> class in a ASTModifiedDefinition at all. It's possible to work around this 
>>>> issue in JS2Doc, but I think this could be a bug in the compiler. Any 
>>>> thoughts?
>>> 
>>> That's just the way Don wrote the parser.  All function and class 
>>> declarations are always going to be wrapped in a modified definition.  I 
>>> don't think there's necessarily a right or wrong way to do this.  The 
>>> parser definition is in WEB-INF/lps/server/sc/src/org/openlaszlo.
>> 
>> I still think it's a bug, global function declarations must not have one of 
>> these modifiers: static/final/override or a namespace.
>> Here's a simple test-case which works in swf8 and dhtml because all 
>> modifiers are removed, but fails to compile for swf10.
>> 

[...]

> I see your point.  Do you want to file a bug?  Maybe you want to try playing 
> with the parser?
> 
> I think the bug is that FunctionDeclaration should not be in 
> ModifiedDefinition, but instead should appear as an alternative to 
> ModifiedDefinition in Directive and StatementList.  ModifiedDefinition at the 
> top level should only allow ClassDefinition.  There is already a separate 
> ClassProperty syntax that handles class methods and properties.

(After sleeping on this) I think the reason Don wrote the parser the way he did 
was that es5 had proposed that you could create 'user modifiers' which would be 
allowed anywhere.  They were essentially a namespace mechanism.  `public`, 
`private`, etc. were just distinguished namespaces.  Clearly that is not how 
as3 is implemented, and clearly we don't allow arbitrary user modifiers, so I 
don't see a problem with changing this.  But I think that is the history of how 
it got to be the way it is.


Reply via email to