This is a great add.

Did you include this new page in the index of site pages that appears on
the right? I don't see it. I can add it, if you like.

And does this feature fall into the category of "New ActionScript language
features in Royale" on https://apache.github.io/royale-docs/features/as3 ?
These come with a caution not to use them if you want your app to be 100%
compiler-neutral.

a


Andrew Wetmore
Assistant VP, Marketing and Publicity, The ASF <http://aparch.org>
Editor-Writer, Infra team, The ASF

Editor, moosehousepress.com


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Jan 20, 2026 at 4:33 PM Harbs <[email protected]> wrote:

> Thank you Josh!!!
>
> This is probably my #1 feature I’ve been missing in ActionScript.
>
> This will do a world of good for type safety and being able to express
> required types!
>
> I’m looking forward to making use of this!
>
> Harbs
>
> > On Jan 20, 2026, at 10:29 PM, Josh Tynjala <[email protected]>
> wrote:
> >
> > Hi folks,
> >
> > I just wanted to take a moment to highlight a new ActionScript language
> > feature that I recently implemented in Royale's compiler: Function type
> > expressions. Or perhaps you might call them strict function types.
> >
> > Basically, instead of using the Function type, like this:
> >
> > var validate:Function;
> >
> > You can define the function signature as a type, like this (The syntax is
> > pretty similar to TypeScript's):
> >
> > var validate:(input:String)=>Boolean;
> >
> > And then, the compiler can check for mismatches. The following assignment
> > will fail:
> >
> > var validate:(input:String)=>Boolean = function(input:ByteArray):Boolean
> {
> > return false; }
> >
> > It should give the following error:
> >
> > Error: Implicit coercion of a value of type (input:ByteArray)=>Boolean to
> > an unrelated type (input:String)=>Boolean.
> >
> > The syntax supports optional parameters and rest parameters. Optional
> > parameters would be equivalent to parameters that have a default value
> in a
> > regular function signature. However, you don't need to specify the
> default
> > value in the function type expression (assigned functions are allowed to
> > have different default values or to use rest instead), and you may use
> the
> > ? token to indicate that a specific parameter is optional.
> >
> > var func:(s?:String, ...rest):void;
> >
> > You can even nest function type expressions.
> >
> > var action:(callback:(result:Object)=>void):void;
> >
> > I've created some documentation to help folks get started:
> >
> > https://apache.github.io/royale-docs/features/as3/strict-function-types
> >
> > --
> > Josh Tynjala
> > Bowler Hat LLC
> > https://bowlerhat.dev/
>
>

Reply via email to