As Lint keeps improving, I feel like we should probably highlight it more 
aggressively in the manual.

 -- John

On Sep 12, 2014, at 10:56 AM, Tony Fong <[email protected]> wrote:

> 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 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
> 
> That's a definite help. Would it be worth (or feasible) generalising to 
> integer variables too? It wouldn't help in the sample function I gave, but 
> you could catch cases like:
> 
> julia> function sumto(n :: Int)
>            total = 0
>            for i in n
>                total = total + i
>            end
>            return total
>        end
> 
> I'd be really interested in seeing an example where this behaviour makes code 
> nicer. If an integer value can be seen as an array of length zero, is there 
> something special about numeric arrays? Given an array of arbitrary type T, 
> should a user always expect that values of type T are iterable?
> 
> If there's any interest, I'd be interested in writing a PR to change this 
> behaviour, as an excuse to familiarise myself with Julia's internals.
> 
> Wilfred

Reply via email to