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
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
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()
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.
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
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...
>
>
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
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
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
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
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
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!
>
>
>
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
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
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
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
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
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
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
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.
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
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
22 matches
Mail list logo