3 ms·
I think you missed the point. Ruby and Python syntax conjoins two concepts: variable declaration and variable binding. This increases the likelihood of subtle n
by gcv 15y ago
I think you missed the point. Ruby and Python syntax conjoins two concepts: variable declaration and variable binding. This increases the likelihood of subtle naming errors, e.g.:
my_variable = 10
# a few lines later...
my_varable = 15
Some kind of "var" keyword makes the problem disappear and makes the programmer's intentions clearer, e.g., when creating temporary variables inside the scope of a conditional or a loop.
In the case of Perl, strict mode also makes it clearer when the programmer wants a lexically ("my") or dynamically ("local") scoped variable, a feature woefully missing in both Ruby and Python.