Comment 0 for bug 483082

Revision history for this message
Matt Giuca (mgiuca) wrote :

Mars has always required variables declared with the "var" keyword.

This is annoying. Mars (like Python) should treat any variable assigned anywhere in the body of a function as local, and infer the type from the assignment statement. (This is already done in interactive mode, and for variables created in switch statements).

The hard part is treating them as locals before they are defined (Mars might assume they are globals if referenced before written, where it should consider it a local-read-before-write error). Come to think of it, this could also be a problem with switch variables. Check that out too.