Since we’re in the headspace of designing better wheels, I thought I’d briefly tell you a bit about my experience learning Julia, a language designed for high-performance numerics.
The language itself, from the position of typing and reading it, is scripty and clear. It lets you incrementally type things. If you leave things untyped, it returns maximally polymorphic expressions. So
2+4 is an expression that works for any datatype able to generate vales from integer literals and combine them with an
+ operator. In that sense it is a bit like Haskel if Haskel silently put independent type wildcards everywhere.
Each named operation is called a
+ is a function. Functions have arbitrarily many
methods, which are implementations of those functions for concrete datatypes, or for explicitly parameterised families of types. Imagine that the only tool you have in your toolbox is a single method typeclass, and you can make new instances of it by just declaring a
def with that name and arity.
The julia compiler only ever generates specialised codepaths. It generates them as needed, expanding them as they are called. So rather than generating a combinatorial explosion of potential code, it just generates the ones you use in your binary.
Lastly, virtually all the interesting stuff in Julia is done through code rewriting. Expressions are first-class, can be introspected, rewritten. It has a quoting/splicing mechanic. So you can implement your higher order function that transforms one function into another as code that rewrites the code of the first function into an implementation of the second. When combined with with the function/method abstraction, this allows the “expression problem” to be essentially ignored, and toolkits for showing, or differentiating, or serializing, or all that good stuff, to be generated using very little code and in a very extensible manner.
Julia isn’t scala, obviously, but I think there are lessons to learn about tidy syntax, the getting started experience, and language design. Especially about removing unrequired ceremony.