On Fri, 18 Nov 2016, Sven Schreiber wrote:
Am 18.11.2016 um 17:45 schrieb Allin Cottrell:
>> On Fri, 18 Nov 2016, Allin Cottrell wrote:
>>> Anyway... we could regularize this by dropping the current practice
>>> of manufacturing an empty list corresponding to no-argument,
No, I think that would be too disruptive.
...
> The easiest (though not the tidiest) thing to do here is just be clear
> in the doc that lists are special in this respect.
Absolutely, that was the point of my original post.
Lists are also special in other ways (e.g., cannot be in bundles, partly
break the encapsulation of functions), so I think keeping it special here
isn't too bad.
However, the new thing that has come up in this thread is the situation with
'string s = null'
after which exists(s)==1 and even more paradoxically isnull(s)==0.
Yeah, but remember that isnull() is deprecated (partly for this sort
of reason).
And which is different from a function parameter default 'string
s[null]' which produces exists(s)==0 inside the function. So I think
this needs fixing (in the short term).
Which fix? Personally I'd rather get rid of 'string s = null', but if
that's too disruptive we could treat strings like lists in this
regard: in case of no arg given for a string param with "null"
default, manufacture an empty string.
Perhaps another long-term solution might also be needed (new keyword
"none"
for defaults, or empty brackets "[]"?).
Yes, I was thinking about "none" too. Ideally we could have "none" and
"empty" as unambiguous alternatives; the trouble with "null" is that
it faces both ways.
Allin