3 ms·
or creates a new global variable otherwise That is the worst possible result. Requiring an explicit local or global keyword is reasonable, defaulting to local
by orangecat 16y ago
or creates a new global variable otherwise
That is the worst possible result. Requiring an explicit local or global keyword is reasonable, defaulting to local is reasonable, defaulting to global is insane.
- bhiggins 16y agoI agree! If you say: x = 5 I think there should be a "var x" either locally or globally -- SOMEWHERE -- and actually there should be a compile error if "var x" is missing.
- m0th87 16y agoGood point. Though defaulting to any sort of variable declaration could be problematic. You might be creating a new variable when you think you're updating one. I like AndyKelley's crash-on-default proposal best. This would also help the compiler in optimizing.