On Tuesday, 6 May 2014 at 20:52:20 UTC, Paulo Pinto wrote:
Am 06.05.2014 22:44, schrieb Chris:
On Tuesday, 6 May 2014 at 17:10:39 UTC, Ary Borenszweig wrote:
On 5/6/14, 10:41 AM, Chris wrote:
On Tuesday, 6 May 2014 at 13:25:56 UTC, Ary Borenszweig
wrote:
On 5/6/14, 8:23 AM, bearophile wrote:
Paulo Pinto:
You can think of Julia as a dynamic language similar to
Python, with
optional typing and for such a young language, a quite
good JIT
compiler backed by the LLVM backend.
Unlike dynamic languages, at running time all variables
are strongly
typed.
What do you mean?
Just a wild guess: that the compiler infers the type of a
variable and
turns it into a static type. That would increase the
security during
runtime (plugins, libraries, crackers).
Julia doesn't have a compiler. There's no compile-time and
run-time
distinction. But functions are jitted before execution.
I know. I was talking about JIT compilation. There must be
some kind of
(jit) compiler.
I don't see how that means "variables are strongly typed". If
you mean
that at runtime they carry their type information, so do
dynamic
languages.
But are the types immutable at runtime (in other dynamically
typed
languages) or can they be reassigned as in
x = "Hello"
x = 5
If yes, then I think this is what Julia is addressing, that a
module,
library or malevolent cracker cannot reassign a different type
to a
variable.
x = 5 // Error!
If so,
They can be re-assigned (http://forio.com/julia/repl/):
julia> x = "Hello"
"Hello"
julia> x = 5
5
julia>
Julia compiler works in a similar way to Self, Strongtalk,
Dylan, Lisp and so on.
The language is dynamic, with optional type annotations and the
compiler does its best to infer the types.
The design of the language is done in a JIT friendly way, while
keeping its dynamic capabilities.
--
Paulo
So what's the point then? To have the program crash at runtime or
better jit-time when the types are not assigned correctly? Then
again, if types can be changed dynamically, how can the jit
compiler say it's "wrong"? Or is there something I've missed?