3 ms·
I'm not sure I'd call Julia a dynamically typed language, each variable can have one and only one (possibly abstract) type which allows the JIT to avoid boxing
by Sean1708 9y ago
I'm not sure I'd call Julia a dynamically typed language, each variable can have one and only one (possibly abstract) type which allows the JIT to avoid boxing and opens up plenty of optimisations.
I'm not particularly convinced that Julia's object model leads to inefficient memory access either.
- StefanKarpinski 9y agoJulia is absolutely dynamically typed [1]. > each variable can have one and only one (possibly abstract) type This is generally untrue except for a rarely used feature allowing declaration of local variables with a certain type (assignment to such variables automatically converts to the declared type). Is this documented incorrectly somewhere? Julia's object model allows a spectrum of array types. At one end, `Vector{Any}` is a Python-like array, and at the other, `Vector{Float64}` is a C-like (or NumPy-like) array with a concrete element type. If the element type is abstract but more constrained than `Any` then you get something in between these extremes. This includes array types like `Vector{Union{Float64,Void}}` and `Vector{Real}`, both of which have abstract element types smaller than `Any`. The former can still store values inline like C arrays, thanks to recent work on efficient representation of unions small values. The latter needs Python-like vector-of-pointers representation because the set of kinds of values it can hold is unbounded since you can add new subtypes of `Real` at any time. [1] https://stackoverflow.com/a/28096079/659248 https://stackoverflow.com/a/28096079/659248
- Sean1708 9y ago> Is this documented incorrectly somewhere? No, I just got myself massively confused at how code_warntype works. Please just disregard everything I said in the above comment.