Should local
at global scope immediately throw an error?
#57483
Labels
triage
This should be discussed on a triage call
From a Hacker News comment today, this code at toplevel throws an error on line 4:
Now I am not too surprised this doesn't work at toplevel, but it's a poor experience for users to encounter the error when reaching for
s
and not when declaring it. If thelocal var =
declaration is guaranteed to be useless, then the code coming after is almost certainly going to have a bug.IMO it would be a better user experience to throw an error on line 1, above, not line 4, since that is where the mistake in this code snippet is. Users will need to learn the global / non-global scoping rules to use Julia effectively, and the sooner we "teach" them the better (and clearly the user in the link above did not have a good experience).
The text was updated successfully, but these errors were encountered: