On Fri, 27 Feb 2015, Steven G. Johnson wrote:

As I understand it, you are asking whether there is a Julia option (e.g. a runtime flag) that will cause Julia to throw an error if you try to parse code where local variables are not explicitly declared, analogous to "use strict" in Perl or "implicit none" in Fortran.

  You understood well.


 There is no such thing in Julia, and I don't recall seeing any discussion of the possibility. (Requiring the programmer to explicitly declare all her variables is a little alien to the Julian style, so I'm guessing there might be some reluctance to implement this in the core language.

I can undertand this, but I have been bitten severely by this kind of problems in Perl (when I was a young fool not using "use strict;") and in Lua (and a few others). It is nice not to have to worry about declarations when you do one-liners or programs of a few dozens lines, but when programs get longer (or have to be maintained after long periods of abandon) the time lost debugging is much bigger than the time lost declaring. Perl and Fortran introduced these options after a while and it is now the first line of any program everyone types in these languages, for good reasons. (It even became the default in Perl 6).

Forgive me if I give the impression of the newcomer (which is what I am) teaching lessons to regular users and seasoned developers, but this is an important point to me, if I want to consider Julia *for my use*. I understand that others may not care about my use, my style, my habits, my troubles, there is no problem with that, my purpose is not to start a revolution in the first thread I open after having written just 2 mini Julia programs :-)


 You could easily implement a Lint-like package to check for this requirement, though.)

I trust you, that *someone* could *easily* do it, but that *I* could do it easily is another story :-)


Goodbye,
  Stéphane.

Reply via email to