3 ms·
For some of the stuff about types and optimisation in particular, you should check out Julia's type system [0]. First-class types, avoiding inheritance, optiona
by one-more-minute 12y ago
For some of the stuff about types and optimisation in particular, you should check out Julia's type system [0]. First-class types, avoiding inheritance, optional type restrictions, and (albeit early) support for static checking [1], it's all there.
It'd be worth taking a look at things like its macros as well – I actually think Julia hits on a lot of the points in this post really well, though of course no language is perfect.
[0] http://docs.julialang.org/en/latest/manual/types/ http://docs.julialang.org/en/latest/manual/types/
[1] https://github.com/astrieanna/TypeCheck.jl https://github.com/astrieanna/TypeCheck.jl
Minor nitpick:
> Tut, tut. That should really be a set! It’s much faster, O(1).
Structures like sets have a lower complexity but higher constants (i.e. the overhead of hashing the value etc). When you have a small number of values, a straight linear search over an array will often be faster (which is why it's useful to have the explicit choice).