On Fri, 2 Mar 2018, Sven Schreiber wrote:
Am 02.03.2018 um 18:15 schrieb Allin Cottrell:
> Not so long ago I tightened up on potential trampling of reserved words in
> hansl, one effect being that you can no longer define a variable with the
> same name as a built-in function.
>
> I now notice that this provokes an error in the gig printout function,
> which defines a scalar named "nobs". At first I thought this must be an
> error in the reserved-words apparatus (isn't it just "$nobs", with a
> dollar, that's reserved?). But on closer inspection I see we also have a
> function nobs(),
Maybe the change was too strict (although I liked it at first). I vaguely
remember a discussion that introducing new built-in functions is not a
problem (as opposed to new commands) because they don't restrict the
namespace as much.
In principle it could now happen that a new built-in function is added and
suddenly breaks existing scripts.
Ah, I think you're right! The way the priorities go in genlex.c we
can have a built-in function foo() and also a variable foo, and
they'll coexist OK. Provided that "foo" is followed immediately by
'(' the function will be called, otherwise the variable will be
referenced. And this means that adding a new builtin function will
not break existing scripts that innocently define a variable of the
same name as the new function.
It seems I was too carried away with avoiding duplicated
identifiers; I'll dial back that change when I get a chance.
Allin