3 ms·
The languages are much more similar than they are different (in terms of feature set, not mindset), but one thing perl has which I don't understand how the pyth
by jbert 17y ago
The languages are much more similar than they are different (in terms of feature set, not mindset), but one thing perl has which I don't understand how the python+ruby people get by without is 'use strict'. (ObLanguageWar: I'm not trying to promote perl here - I know the other languages have particular features perl does not - I'm just curious about this specific item.)
Every sane perl programmer will have this pragma enabled, and it requires you to declare lexical variables, otherwise you get a compile-time error.
I understand (please correct me if I'm wrong) that python+ruby instead allow lexicals to be created by assignement, leading to this problem:
def important_condition():
return 1
FOO = "wrong"
if important_condition(): FO0 = "correct"
print FOO
I'm told there are lint-like tools for python which can catch this, but since people typically don't use Makefiles to manage their python/perl/ruby code I can't imagine they are routinely used on each edit/run cycle.
Can any python/ruby coders comment on this? Is it an error case which takes any significant debugging time? (Rather than the O/0 distinction above, I see this sort of error more often from inConsistent camelCase).