Duplicate variables in function arguments do not cause an error
Root / SmileBASIC Bug Reports / [.]
12Me21Created:
These 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 ENDThe 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 END
DEF FUNCTION OUT X VAR X X=1 'this modifies the variable created by VAR, not the OUT variable. END
DEF FUNCTION X OUT X X=4 'this modifies the input X, not the output X ENDThis 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)