It sounds like you're trying to get something like GCC's -Wshadow: warn 
when a local variable shadows another from a higher scope.  But that's not 
an easy thing to make useful; here's an interesting email from Linus 
talking about the uselessness of 
-Wshadow: 
https://groups.google.com/d/msg/fa.linux.kernel/jjk_K4HOemQ/_MO-iLgIipkJ

Much of that also applies to julia, except that (to my knowledge) the 
useful case where "it's often entirely interesting to hear about local 
variables that shadow each other" doesn't really apply.  Local variables 
will only shadow each other if you're very explicit and declare the inner 
variable to be local.

While Matlab's scoping can be somewhat crazy, one nice thing that the 
syntax highlighter does is it changes the color of variables that are 
shared across functions, are persistent, or are global.  It's not a lint 
warning, but I often treat it as such.  That may be a better way of 
communicating this kind of "warning," but it requires an IDE.

On Wednesday, June 11, 2014 11:30:09 AM UTC-4, Tony Fong wrote:
>
> You are assuming perfect knowledge of Julia and with a fresh mind on the 
> part of the user...
>
> On Wednesday, June 11, 2014 11:26:48 AM UTC-4, Stefan Karpinski wrote:
>>
>> f2 doesn't modify global foo – precisely because it doesn't declare foo 
>> to be global. So there's nothing to warn about...
>>
>>
>> On Wed, Jun 11, 2014 at 10:58 AM, Tony Fong <tony...@alumni.princeton.edu
>> > wrote:
>>
>>> I'm struggling with something like this:
>>>
>>> Module M
>>>   foo = 1
>>>   bar()=foo # it's not obvious if foo can be modified. Ok, maybe I 
>>> should not need a FYI even. 
>>>   f1()=(global foo=2 ) # this is clear.
>>>   f2()=(foo = 3 ) # how could I get a warning out of this? it's 
>>> perfectly legal and may or may not do what the author intends.
>>> end
>>>
>>>  
>>>

Reply via email to