Re: Proposal for variadic functions

>> If so, why is this restriction?
> To keep the rules simple and understandable, and to enable simple and clear error messages when people get things wrong. It would be possible in theory to have one function F with arity range 1-2 and another with arity range 3-5, but things like function-lookup would all get unnecessarily complicated.

Also, extensibility. It's common to address new requirements by adding new parameters to functions - not always an ideal solution, but often the most practical, and allowing defaults on optional parameters is designed to facilitate this kind of evolution. The last thing you want is to find you can't add another parameter to a function because the arity range now overlaps that of a different function. You also don't want addition of a parameter to invalidate an existing reference like F#4.

Michael Kay

Received on Tuesday, 8 December 2020 16:44:52 UTC