On Fri, 26 Jan 2007, Sven Schreiber wrote:
1. package the following example function:
function test(list myl[null])
if nelem(myl) != 0
print "This shouldn't be printed if the user didn't touch the
2. open some datafile and create an arbitrary but non-empty list named
3. execute the function package from step 1; list "spam" appears as
selected in the list input drop-down menu
So the function package does not honor the [null] default setting.
Nothing too serious, but a little annoying.
Thanks, I now see what you mean.
It seems to me: whether this is a problem or not is a bit subtle,
and depends on the context. When a function gives a [null]
default for a list argument, is it saying A or B?
A: "I'd normally expect a list here, but if you don't want to give
one I can manage without"
B: "A basic invocation of this function wouldn't have a list
here, but if you want to get fancy you can specify one"
I presume you have case B in mind, but in case A the behaviour you
describe you not, I think, seem wrong.