|
|
|
|
|
by grncdr
352 days ago
|
|
I believe it’s slightly different in that I can declare a value (or parameter) of type T and know that it can’t be null/invalid. Consider this Java method: void frobnicate(bar Bar)
{
// is bar null? Who knows?
}
To get the same behavior in Helix, one would have to declare the parameter type as “Bar?”. If the parameter type is plain “Bar”, callers can still pass you a “Bar?”, but presumably you’d get an NPE at the call site and not somewhere further down the stack.I’ve never heard of this language before today and don’t have an opinion on it, but I do find the Questionable Types interesting: sort of collapsing Option and Result into one very concise notation. |
|
You get safety for the non-questionable types. But it seems like if you're going to have questionable types, you're better off not letting users silently treat them as if they aren't questionable and then risk crashing at runtime.