4 ms·
They got that from lisp.
by Foober223 6y ago
They got that from lisp.
- bjoli 6y agoJulia compensates for time lost by making a lot more use of it in the stdlib than, say, most CL implementations do. It is as if the julia people saw it and went "wow, this is good!" and had it in from the beginning. With their focus on maths, it is hardly surprising.
- eigenspace 6y agoThere's actually a pretty fundamental reason that Julia's Base and stdlib makes more use of multiple dispatch than Common Lisp (or any other language in existence with multiple dispatch). It's that in basically every other language, multiple dispatch comes with a non-neglible performance penalty. Julia's multiple dispatch semantics were designed around having a JIT compiler, and it's JIT compiler design was designed around having multiple dispatch, and this tight integration let us be really good at de-virtualizing the dispatch, removing the hefty performance pentalty. This is why even basic arithmetic operations like +, * and whatnot are able to be generic functions (with a gigantic number of methods, 184 for + and 364 for * currently just in Base and LinearAlgebra!) without any runtime performance compromise. By contrast, Nim for instance just removed multiple dispatch in their 1.0 release because nobody was using it due to being so slow.
- bjoli 6y agoThanks! I always suspected you could have a fast dynamic dispatch in a typed language if you locked it down enough to not allow redefinitions at runtime and such (which removes a lot of the fun of CLOS). It makes sense to let the jit do the heavy lifting though!
- eigenspace 6y agoYes, Julia definitely had to make some dynamism restrictions that I suspect would dismay some lispers, but it is still a quite dynamic language. The language devs do some pretty clever things to have our cake and eat it too. On the flip side, I think we have some dynamic metaprogramming magic of our own that might even impress some lispers such as IRTools.jl's dynamos or Cassette.jl's overdubing.