Duplicate variables in function arguments do not cause an error
#1✎ 161912Me21Head AdminSecond YearMy account is over 2 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfThese programs should all throw duplicate variable errors, but they do not:
This one isn't so bad, but the second input value cannot be accessed:
DEF FUNCTION X,X
PRINT X 'this accesses the first input value
The rest will usually cause an "Uninitialized value" error, because the output variables are inaccessible and can't be set.
DEF FUNCTION OUT X,X
X=1 'this only modifies the first X
ENDDEF FUNCTION OUT X
X=1 'this modifies the variable created by VAR, not the OUT variable.
ENDDEF FUNCTION X OUT X
X=4 'this modifies the input X, not the output X
This bug causes a lot of confusion because people will try to write functions like DEF MOVE X,Y OUT X,Y, which will not work as intended, as well as trying to use VAR to declare OUT variables.
(It might be better if DEF FUNCTION X OUT X was treated as DEF FUNCTION X_IN OUT X : X=X_IN, because this will act the way people expect)