News for hackers. Stuff that matters.
Re:Grain: A strongly-typed functional programming language f... by macintux on Tuesday July 31, 2018 @09:40AM (#17653013)
>> The language uses the type system to propagate such errors.

...

> Erlang for example follows that pattern.

Erlang is its own beast; if you characterize pattern matching as part of a type system, which I guess it is, then...maybe if you squint?

Normal errors are indeed typically reflected in the return value, but if the error pattern doesn't match the code's expectations then a runtime exception is thrown...if you're lucky. If the error pattern happens to fit with the pattern match but the code doesn't know about it, eventually some other error will occur.

Anyway, Erlang definitely doesn't fall into the "No runtime exceptions, ever" category, and as such doesn't really fit with the options the OP presented.

Re:Grain: A strongly-typed functional programming language f... by dragonwriter on Tuesday July 31, 2018 @12:47PM (#17654715)
> Normal errors are indeed typically reflected in the return value, but if the error pattern doesn't match the code's expectations then a runtime exception is thrown

With a sufficiently complete static (even inferred) type system, you can catch any possibility of such failures AOT and not run into any error patterns that don't match code expectations at runtime, so while the description isn't literally true of Erlang, Erlang does show a way that it could be true of a language with AOT enforcement of adequate type system.

Re:Grain: A strongly-typed functional programming language f... by colanderman on Tuesday July 31, 2018 @10:04AM (#17653199)
I think we read the OP differently. I'm just responding to the bit about errors being returned as an "Either" type. You are right that Erlang does not enforce pattern matching to succeed, though its static analyzer (Dialyzer) can catch many instances when it definitely won't.