The expression solution

Compiler & type system development is hard, and there have been more pressing concerns (like compilation speed, compilation caching, …) since 1.0.

It’s also good to remember that retrofitting sum types into the existing language (e.g. by forcing users to take care of the return type of findfirst before their code compiles) is (in general) a breaking change - and Julia just isn’t at that stage of development anymore. Arguably, code that uses findfirst and ignores the nothing case may be broken - but it may also not be, if in the semantics & context surrounding the call the developer knows that this will never be nothing. That’s not something we can know though, so changing it and forcing users to handle that case explicitly (barring a perfectly knowledgeable compiler, which we don’t have) is not something that can be done right now (unfortunate as that is), because that would change currently working (& correct!) code into code that is now broken.

That’s not to say we’ll never get sum types (or something like it) - just that the path to getting there needs to take A LOT of existing code into account, which adds to the complexity/difficulty.

6 Likes