Argument unpacking?

Peter Hall peterjoel at gmail.com
Sun Nov 12 17:13:45 PST 2006


ES3 has little to do with it. In ES4, apply's signature would
currently be something like:

     function apply(target:Object, args:Array):*;

And there would be compile-time and run-time errors if args was not an
Array. With P T Withington's suggestion, it would be:

     function apply(target:Object, ...rest):*;

in which case, there would be no compile-time errors and run-time
errors would depend on the implementation.

Agreed that apply() is intrinsically dynamic, but there can be some
constaints on how it is used, and those can be enforced by the
language.

Peter

On 11/12/06, David A. Herman <dherman at ccs.neu.edu> wrote:
> > Also, unless I'm missing something, the language wouldn't be able to
> > enforce the type of that last array argument any more. So, while this
>
> In ES3 there's no type enforcement, and I wouldn't count on being able to
> come up with a type for apply anyway. I'm not saying I agree with one side
> or another on this point, but I'm not sure our type system can express
> useful type constraints on apply. I believe it's a dependently typed
> function.
>
> Dave
>



More information about the Es4-discuss mailing list