[julia-users] Re: Suprises with for loops

2014-09-12 Thread Tony Fong
Lint v0.1.2 starts to track variables' type locally within a function declaration. So your case will correctly trigger a lint warning. Tony On Thursday, September 11, 2014 4:32:09 AM UTC+7, Wilfred Hughes wrote: On Monday, 8 September 2014 14:54:50 UTC+1, Tony Fong wrote: @snotskie looped

[julia-users] Re: Suprises with for loops

2014-09-10 Thread Wilfred Hughes
On Monday, 8 September 2014 14:54:50 UTC+1, Tony Fong wrote: @snotskie looped me into this discussion in the context of Lint I have updated Lint.jl (v0.1.1) to give warnings over * for-loop when the iterable is just a literal number * nested vcat, i.e.[[1,2],[3,4]]. Other array formats are

[julia-users] Re: Suprises with for loops

2014-09-08 Thread Tony Fong
@snotskie looped me into this discussion in the context of Lint I have updated Lint.jl (v0.1.1) to give warnings over * for-loop when the iterable is just a literal number * nested vcat, i.e.[[1,2],[3,4]]. Other array formats are unaffected since their ASTs are distinct. Tony On Monday,

[julia-users] Re: Suprises with for loops

2014-09-07 Thread Patrick O'Leary
On Sunday, September 7, 2014 6:00:55 AM UTC-5, m...@wilfred.me.uk wrote: I've been writing a few for loops in Julia and seen a few behaviours that were surprising to me: Firstly, it seems that using `in` is converted to `=` at some point in the parser. This caught me out when looking at a

[julia-users] Re: Suprises with for loops

2014-09-07 Thread me
Thanks for the response. It's both less bad and weirder than that. Integers are iterable. Cripes! I've found the relevant mailing list thread you mentioned: https://groups.google.com/forum/#!msg/julia-users/bNDcBnF5hd0/q2GL2UtbmVIJ . Stefan mentions this decision could be revisited, so I'm

Re: [julia-users] Re: Suprises with for loops

2014-09-07 Thread Tim Holy
With a sufficiently compelling argument, I imagine it might be conceivable--- there are other equally-fundamental decisions that are viewed as being in-play during the 0.4 series. You might start by disabling that behavior and then seeing what aspects, if any, of `make testall` break. But as an

Re: [julia-users] Re: Suprises with for loops

2014-09-07 Thread Stefan Karpinski
If you identify scalars with zero-dimensional arrays, then this behavior falls out naturally. In Julia those *are* different things, but it still makes sense for them to behave similarly. To make a hard break between a zero-dimensional array and a scalar seems to me to require some argument –

Re: [julia-users] Re: Suprises with for loops

2014-09-07 Thread Jason Merrill
I haven't run into this problem in Julia, but making too many things iterable can make it hard to write generalized flatten. I.e. you might want to say something like if an element is not iterable, push it onto the accumulator; otherwise, flatten it recursively. Doesn't work like you'd expect