I think Lint.jl might handle this already: https://github.com/tonyhffong/Lint.jl

 -- John

On Aug 14, 2014, at 2:39 PM, Ethan Anderes <[email protected]> wrote:

> It's funny, this issue is by far my biggest source of bugs when coding in 
> Julia. I find myself often prototyping things with commands in the global 
> REPL scope, then wrapping everything into a function once I get it working. 
> Then I forget to pass a variable as an argument to the function and the 
> function accidentally reaches out to the global scope from within the 
> function. It would be nice if there was an easy macro which could warn me 
> (something basic like @time but which says "btw: your reaching into global 
> scope for some non-function variables"). Unfortunately I don't really know 
> how to write such a macro.
> 
> Cheers,
> Ethan
> 
> On Thursday, August 14, 2014 2:01:08 PM UTC-7, Carlos Becker wrote:
> Hi all.
> 
> I have been busy and not following the julia development news. are there any 
> news wrt this topic? 
> 
> What I find dangerous is mistakenly referencing a global variable from a 
> local context, when that is not intended.
> To me it seems worth adding a qualifier to specify that whatever is not 
> declared as 'global', should only be local (or an error should be thrown).
> This could also be a julia flag. Do these ideas seem reasonable?
> 
> Cheers.
> 
> El sábado, 8 de marzo de 2014 03:40:37 UTC+1, Stefan Karpinski escribió:
> How about check_locals? You can check for both unused and potentially 
> unassigned locals.
> 
> On Mar 7, 2014, at 5:39 PM, Leah Hanson <[email protected]> wrote:
> 
>> Adding that to TypeCheck sounds pretty reasonable. Functions already provide 
>> their local variable names, so it would be a matter of finding all variable 
>> usages (excluding LHS assignments). I can probably find time in the next 
>> week or so to add it. Maybe "check_for_unused_local_variables"? (which seems 
>> long, but descriptive)
>> 
>> -- Leah
>> 
>> 
>> On Fri, Mar 7, 2014 at 4:02 PM, Jiahao Chen <[email protected]> wrote:
>> On Fri, Mar 7, 2014 at 4:22 PM, Stefan Karpinski <[email protected]> 
>> wrote:
>> > I would prefer to have opt-in (but easy to use) code analysis that can tell
>> > you that "anwser" is an unused variable (or in slight variations of this
>> > code, that "answer" or "anwser" is always or sometimes not assigned).
>> 
>> That sounds like -Wimplicit in fortran compilers, which forces IMPLICIT NONE.
>> 

Reply via email to