Harbs opened a new issue #207:
URL: https://github.com/apache/royale-compiler/issues/207


   Currently in ActionScript, it's only possible to declare function signatures 
for methods and package level functions. It's not possible to declare 
signatures for variables and function paramters. The best you have is `var 
foo:Function` or `function foo(fun:Function):Function{}`.
   
   This in my opinion is the biggest hole in the ActionScript type system. I 
have felt this lack for a very long time. It's very commonly felt in event 
handlers, but possibly a bigger issue is that it makes ActionScript a poor 
choice for functional-style programming.
   
   If I had only one feature I could add to the language, it would be typed 
functions with signatures.
   
   The exact syntax is less important than the type safety. My initial 
suggestion would be Vector style angle brackets with content like you'd use for 
an interface. Something like this: `var fun:Function.<(ev:Event):void>` or 
`function foo(callback:Function.<(handler:IAsyncTask):IAsyncTask>):void{}`.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to