You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2022/01/18 20:51:42 UTC

[GitHub] [royale-compiler] joshtynjala commented on issue #207: Typed Functions with signatures

joshtynjala commented on issue #207:
URL: https://github.com/apache/royale-compiler/issues/207#issuecomment-1015823549


   This is definitely something I have always wanted to see in AS3.
   
   If this were to be implemented, one thing that should be allowed is something like this:
   
   ```as3
   var fun:Function.<(ev:Event):void> = function(ev:Object):void {};
   ```
   
   To be clear, Event is a subclass of Object, so that function should be allowed for the same reason why you can assign an `Event` instance to a variable of type `Object`.
   
   ```as3
   var obj:Object = new Event();
   ```
   
   With return types, there's a similar situation, but instead of superclasses, subclasses would be allowed.
   
   ```
   var fun:Function.<():Object> = function():Event {}
   ```


-- 
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: issues-unsubscribe@royale.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org