Well, I guess this partially answers my own question:
a = 0
println(typeof([a for i=1:10]))
function f()
a = 0
println(typeof([a for i=1:10]))
end
f()
let
a = 0
println(typeof([a for i=1:10]))
b = 0
println(typeof([b for i=1:10]))
end
outputs
Array{Any,1}
Array{Int64,1}
Array{Any,1}
Array{Int64,1}
So, it's not the same (unless one takes care of declaring variables as
local)...
On Friday, June 13, 2014 11:44:30 AM UTC+1, Cristóvão Duarte Sousa wrote:
>
> According to the performace tips, code must be inside functions and
> variable must be local for better optimization.
>
> In IJulia notebook I usually put critical code inside dummy functions,
> something like
>
> function f()
> # variables and code here
> end
> f()
>
> I wonder if doing the visually nicer
>
> let
> # variables and code here
> end
>
> would provide the same benefits?
>
>
>