If it isn't too much trouble, I would welcome a way to say: The following
parameters with default values should _not_ receive actual arguments (and
doing so should cause an error just like giving too many arguments to any
other function). The syntax could be something like this:
def generator(aa, bb):
def result(x, y = 2, z = 0 ! a = aa, b = bb):
return x * a + y * b - z
return result
The result of calling generator should then accept only one, two or three
arguments, but not less or more. For arbitrary-length argument lists, the
respective syntax would be:
def result(x, y = 2, z = 0, *rest ! a = aa, b = bb):
# ...
I've used "!" since it stands out clearly, but if the public taste is for
resusing existing tokens, we could also use ";". (Obviously, we shouldn't
introduce parsing problems wrt. any preceeding default expression.)
To make the case where no arguments should be excepted appear symmetrical
we may also replace the binding symbol "=", instead of the separator ",".
In that case, I'd suggest using "==". So a function without arguments but
with initialized parameters would look like this:
def const(a == aa):
return a
Now that I've written it, the latter form even looks better for me.
------------------------------------------------------------------------------
* wonder everyday * nothing in particular * all is special *
Marc Wachowitz <mw@ipx2.rz.uni-mannheim.de>