5 ms·
Don't you need sum types/sufficiently powerful enums for Result though? Which, in a way, makes it a language feature.
by Zababa 5y ago
Don't you need sum types/sufficiently powerful enums for Result though? Which, in a way, makes it a language feature.
- masklinn 5y agoYou’re confusing the chicken for the egg. Sum types are a powerful language feature, but they’re also a general language feature, they don’t exist for the sole purpose of creating a Result type (and indeed a number of languages have had the former and lacked the latter).
- Zababa 5y agoDo you mean that in contrast to affine types, that are here for borrow checking?
- masklinn 5y agoNo, I mean that in contrast to the other side of the discussion (zig’s errors). And affine types are not here for borrow checking, it’s closer to the opposite. Affine types are a formalisation of RAII, borrow checking is a way to make references memory-safe without runtime overhead which mostly avoids unnecessary (and sometimes impossible requiring allocations & refcounting) copies of affine types.
- sph 5y agoI still don't get what's wrong with having custom syntax or language facilities to support a feature. Why is that a problem?