[Nickle] Multiple definitions of variable names in same scope do not cause an error

David M Guy guyd at cs.pdx.edu
Mon Nov 10 13:23:59 PST 2003


I wrote some nickle test code in which I made a copy/paste error,
accidentally declaring a variable name twice, but the interpreter did not
raise an error.

As an example, the following code parses and executes normally:

/**** BEGIN CODE SAMPLE  ****/
#!/pkgs/nickle/bin/nickle

int a = 3;
int a = 4;
printf("a = %d\n", a);  /* a = 4 */

exit(0);
/**** END CODE SAMPLE  ****/


Question: Is this a bug or by design?

Personally, I would prefer if the interpreter considered this an error.

Thanks,

David Guy



More information about the Nickle mailing list