May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Dejan Lekic | Dejan Lekic:
> One can argue that every modern JIT achieves "almost native performance" ...
OK. Then for Julia remove the "almost" :-)
Bye,
bearophile
| |||
May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | 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, | |||
May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Chris | 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 | |||
May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | 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?
| |||
May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | Paulo Pinto: > They can be re-assigned (http://forio.com/julia/repl/): > > julia> x = "Hello" > "Hello" > julia> x = 5 > 5 > julia> I think the JIT compiler splits those two in two different variables :-) > The language is dynamic, The language tries its best to be flexible as a dynamic language. But variables never carry a run-time type tag, unlike in Lisp. Bye, bearophile | |||
May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | Am 06.05.2014 23:00, schrieb bearophile:
> Paulo Pinto:
>
>> They can be re-assigned (http://forio.com/julia/repl/):
>>
>> julia> x = "Hello"
>> "Hello"
>> julia> x = 5
>> 5
>> julia>
>
> I think the JIT compiler splits those two in two different variables :-)
>
>
>> The language is dynamic,
>
> The language tries its best to be flexible as a dynamic language. But
> variables never carry a run-time type tag, unlike in Lisp.
>
> Bye,
> bearophile
That is an implementation detail I would say, but then again I only saw a few talks online and have not played that much with it.
--
Paulo
| |||
May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | Paulo Pinto:
> That is an implementation detail I would say,
It's not an implementation detail, it has consequences on the kind of code you are allowed to write, because it's not really a dynamic language. After the JIT compilation it's "statically" typed, with some niceties like the type splitting you have seen with the x variable. In Julia you can't write all the programs you can write in Python. But in practice the limitations are not a problem for the scientific code, and the advantages are great.
Bye,
bearophile
| |||
May 06, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Chris | On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:
> Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.
I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects.
However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility.
I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
| |||
May 07, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Tuesday, 6 May 2014 at 21:31:32 UTC, bearophile wrote:
> Paulo Pinto:
>
>> That is an implementation detail I would say,
>
> It's not an implementation detail, it has consequences on the kind of code you are allowed to write, because it's not really a dynamic language. After the JIT compilation it's "statically" typed, with some niceties like the type splitting you have seen with the x variable. In Julia you can't write all the programs you can write in Python. But in practice the limitations are not a problem for the scientific code, and the advantages are great.
>
> Bye,
> bearophile
Maybe we are talking across each other, but JIT code is always statically typed after native code generation.
The approach taken by Julia is no different than other dynamic languages that enjoy AOT native compilers.
If you mean Julia allows for less dynamic programming cleverness as Python, there I agree with you.
I guess I need to play more with it, maybe then I can better grasp what you mean.
--
Paulo
| |||
May 07, 2014 Re: Julia vs. D? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Tuesday, 6 May 2014 at 21:00:18 UTC, bearophile wrote:
> The language tries its best to be flexible as a dynamic language. But variables never carry a run-time type tag, unlike in Lisp.
Hmm... Then how can I do this:
x = 5
typeof(x) # evaluates to "Int64"
x = 5.0
typeof(x) # evaluates to "Float64"
?
Is Julia doing something trickier than I think it is? Or do you just mean they don't carry type tags after compilation?
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply