Bill Allombert on Mon, 18 Mar 2013 18:06:11 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: function defaults |
On Mon, Mar 11, 2013 at 06:54:17PM +0100, Bill Allombert wrote: > I created a branch bill-strictargs which add a new default: > > Doc: this toggle is either 1 (on) or 0 (off). If on, all arguments to new > functions are mandatory unless the function supply an explicit default value. > Otherwise arguments have the default value $0$. > > The default value is \kbd{0}. > > Example: > > ? default(strictargs,1) > ? f(x,e=0)=x+e > %1 = (x,e=0)->x+e > ? f(5) > %2 = 5 > ? f() > *** at top-level: f() > *** ^--- > *** in function f: > *** ^- > *** missing mandatory argument in user function. > > the error message should be improved. > > Note that this affect functions at compile time, but the test is done at runtime. I have commited this branch. Thanks for the suggestion! Cheers, Bill.