> the most important use case for type instability seems to be allowing a good interactive experience in the Repl.
In many cases, type instability is indeed a performance penalty and indicative that better code can be written. However, I would argue that the most important use case for type instability is to be able to write functions where the return type encodes properties of the inputs that can only be determined at runtime. Numerical routines like factorize, qrfact and sqrtm make use of dynamic return types in this way. On Fri Jan 02 2015 at 2:25:37 PM Ariel Keselman <[email protected]> wrote: > Hi, I Just want to discuss this idea: type instability in functions is a > source of slowness, and in fact there are several tools to catch instances > of it. I would even say that ising type instability in functions is > considered bad style. > > the most important use case for type instability seems to be allowing a > good interactive experience in the Repl. Now since work in the repl is > always in global scope I think disabling type instability in functions > would not change this interactive experience. Then it would give us several > serious advantages: > > 1. No type instability slowness to chase, a few less tools to maintain > > 2. Since types in functions are stable, They could be statically type > checked just before compilation (not definition). So ifnyou try to run a > function that calls some non existent method you'll get an error on compile > time > > I don't like to call julia dynamic, I prefer interactive. And I realise > there are many subtleties here and this is really not that easy to > implement, but maybe julia could be the first interactive and statically > typed language. Hope I'm not being too greedy ;) > > Also look at the crystal language, they use some techniques similar to > those used in julia to do global type inference. They achieve fast compiled > programs without ever having to type a thing. And of course you can still > get type errors at compile time and some good tooling like statically typed > languages. They miss though the interactivity at global scope. > > Thoughts?
