Currently the spec is silent on whether it should be possible to create new functions with the Function constructor that have type annotations, default arguments, rest arguments, and a return type annotation.
Do we want this? Here's a proposal for how to do it.
Recall that if the Function constructor is called with n parameters, the n-1 first are concatenated to form a comma-separated list of identifiers by simply joining them with "," strings.
I propose that we allow the first character of such a joined string to be a left parenthesis "(". If it is, then the entire string must be parseable as a parameter list optionally followed by a return type annotation.
Any type names in these annotations must resolve in the global scope, obviously.
For example:
new Function("(a:int, b:int):int", "a+b")
new Function("(a:int" "b:int):int", "a+b")
One could implement arbitrarily complex rules here for "convenience", or one could say that the leftparen is only allowed if there are exactly two parameters passed to the constructor (the first example above would be valid but not the second).