There is a problem with that. If it is an error to provide too many actual parameters to a function with typed formal parameters, then you either must supply the correct number of args or not type the args.
A use case that demonstrates the problem is the Array.some callback. Usually it is supplied with only one argument -- the element. So if a user declares this callback with type annotations, the call will fail as the iterator must supply 3 arguments. So you can't have a callback with just one typed argument for the callback. You must either have one untyped arg or 3 typed arguments. Michael On May 9, 2008, at 10:58 AM, David Mandelin wrote: > Lars Hansen wrote: >> I would expect excess arguments to typed functions to be ignored >> silently, >> as they can be picked up by 'arguments' inside the function. >> >> > Is there any possibility of making whether a function takes extra > arguments part of its type? It seems kind of unfortunate not to be > able > to report an error when too many args are given, which is a pretty > common mistake and usually indicates a bug. > > Dave > _______________________________________________ > Es4-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es4-discuss _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
