Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-14 Thread Tony Fong
Issue filed. https://github.com/JuliaLang/julia/issues/7234 Let's get back to an earlier discussion. Having mulled over the points so far. I have conceded that it's heavy-handed to warn omission of global if we are not trying to change them, especially if the global name is unambiguous. So I

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-12 Thread Mauro
I was hoping that someone more knowledgeable would respond, but no luck... I think this is a bug. Could you file an issue? This also happens with a (;) block, a let-block and inside functions: julia> function fn() foo = 1 bar() = (foo=foo+1; foo) bar() en

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Tony Fong
I'm sure you have a point in that example. However, I'm getting more confused after playing around some more. In repl when I do this: > foo = 1 > bar() = (foo=foo+1) > bar() I get ERROR: foo not defined. So far so good. But if I write it like this: > begin > foo = 1 > bar() = (foo=foo+1) > bar()

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Matt Bauman
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.

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Stefan Karpinski
I'm just pointing out that you can't change a global binding without declaring it to be global. That's why I'm confused about what the warning could possibly be for. On Wed, Jun 11, 2014 at 11:30 AM, Tony Fong wrote: > You are assuming perfect knowledge of Julia and with a fresh mind on the > p

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Tony Fong
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... > >

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Stefan Karpinski
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 wrote: > I'm struggling with something like this: > > Module M > foo = 1 > bar()=foo # it's not obvious if foo can be modifie

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Tony Fong
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 w

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Stefan Karpinski
Maybe I'm confused about what you mean by "using globals". I assumed you mean just accessing a global in any way from a function. So, for example, this would be using a global: module M foo = 1 bar() = foo end But this has no side effects since the global isn't modified. Are you talking abou

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-11 Thread Tony Fong
Yes, I thought I was catching the right error, but later realized that I was being too militant assuming that a proper function has no "closure". Obviously there is, and the default closure has all the globals. However, I think using globals in a function can be surprising for a user that assum

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-10 Thread Stefan Karpinski
This is really nice work. In the future, I'd really like to move bits of TypeCheck and this sort of linting into base Julia, maybe invoked with a -w flag. Regarding this: Using globals in function without declaring them (This one isn't an error, > but I personally prefer explicit declaration of g

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-10 Thread Tony Fong
It's a great idea! I'll look into it. Thanks for the pointer. On Tuesday, June 10, 2014 5:50:27 AM UTC-4, René Donner wrote: > > I don't know how feasible it is, but a (perhaps optional) inclusion of the > functionality in https://github.com/astrieanna/TypeCheck.jl would be > great! > > >

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-10 Thread René Donner
I don't know how feasible it is, but a (perhaps optional) inclusion of the functionality in https://github.com/astrieanna/TypeCheck.jl would be great! Am 09.06.2014 um 00:46 schrieb Tony Fong : > Thanks. PR created. > > I have added a few more low hanging fruits to the Lint module: > * correct

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-10 Thread René Donner
I don't know how feasible it is, but a (perhaps optional) inclusion of the functionality in https://github.com/astrieanna/TypeCheck.jl would be great! Am 09.06.2014 um 00:46 schrieb Tony Fong : > Thanks. PR created. > > I have added a few more low hanging fruits to the Lint module: > * correct

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-08 Thread Tony Fong
Thanks. PR created. I have added a few more low hanging fruits to the Lint module: * correct line location * detect duplicate keys in constructing Dict * detect recycling out-of-scope local variable name inside a block. * an heuristic attempt to detect very similarly structured consecutive expres

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-07 Thread John Myles White
Yeah, there’s some GitHub specific machinery you’ll have to learn: https://help.github.com/articles/creating-a-pull-request — John On Jun 7, 2014, at 6:14 AM, Tony Fong wrote: > Sorry, I just tried to go through the docs, now I'm stuck at "creating a pull > request". I have no idea what I'm

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-07 Thread Tony Fong
Sorry, I just tried to go through the docs, now I'm stuck at "creating a pull request". I have no idea what I'm doing... On Saturday, June 7, 2014 5:48:19 PM UTC+7, Tim Holy wrote: > > Actually, I was right the first time. Needs to be registered before > `Pkg.add("Lint")` will work. > > --Tim

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-07 Thread Tim Holy
Actually, I was right the first time. Needs to be registered before `Pkg.add("Lint")` will work. --Tim On Saturday, June 07, 2014 05:34:13 AM Tim Holy wrote: > Ah, it is a package already. Oops. > > --Tim > > On Friday, June 06, 2014 02:22:22 PM Tony Fong wrote: > > Hello, > > > > First of al

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-07 Thread Tim Holy
Ah, it is a package already. Oops. --Tim On Friday, June 06, 2014 02:22:22 PM Tony Fong wrote: > Hello, > > First of all, let me say it's been a real pleasure working in the Julia > environment. > > I have been coming from a very different platform, and I noticed myself > making mistakes of a c

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-07 Thread Tim Holy
This is really cool. IMO this indeed fills an important gap with respect to other platforms; I was initially skeptical about lint checkers, but I've noticed that when writing Matlab code the lint really does save a nontrivial amount of debugging time. I tested this out, and it looks very nice.

Re: [julia-users] ANN: Lint.jl - a little code lint tool

2014-06-06 Thread John Myles White
Very cool. -- John On Jun 6, 2014, at 2:22 PM, Tony Fong wrote: > Hello, > > First of all, let me say it's been a real pleasure working in the Julia > environment. > > I have been coming from a very different platform, and I noticed myself > making mistakes of a certain pattern. So as a l

[julia-users] ANN: Lint.jl - a little code lint tool

2014-06-06 Thread Tony Fong
Hello, First of all, let me say it's been a real pleasure working in the Julia environment. I have been coming from a very different platform, and I noticed myself making mistakes of a certain pattern. So as a little side project, I wrote this little tool called Lint.jl that can check for som