On Tue, Jan 26, 2016 at 1:24 PM, Sisyphuss <[email protected]> wrote:
> I have the following code:
>
> function factorial(n)
>   function fact_iter(product, counter, max_count)
>     if counter > max_count
>       product
>     else
>       fact_iter(product * counter, counter + one(counter), max_count)
>     end
>   end
>
>   fact_iter(one(n),one(n),n)
> end
>
> By `@code_warntype factorial(10)`, it is "end::Any", which means type
> instable.
>
> However, if I move the definition of `fact_iter` outside, it will get
> "end::Int64", which means type stable.

Closures doesn't perform well. Probably fixed on jb/function.

Reply via email to