| ▲ | elcritch 5 hours ago | |||||||
The compiler can still enforce checks, such as with nil checks for pointers. In my opinion it’s overall cleaner if the compiler handles enforcing it when it can. Something like “ensure variable is initialized” can just be another compiler check. Combined with an effects system that lets you control which errors to enforce checking on or not. Nim has a nice `forbids: IOException` that lets users do that. | ||||||||
| ▲ | ux266478 4 hours ago | parent | next [-] | |||||||
Both of these things respectively are just pattern matches and monads, just not user-definable ones. | ||||||||
| ▲ | umanwizard 5 hours ago | parent | prev [-] | |||||||
> The compiler can still enforce checks, such as with nil checks for pointers. Only sometimes, when the compiler happens to be able to understand the code fully enough. With sum types it can be enforced all the time, and bypassed when the programmer explicitly wants it to be. | ||||||||
| ||||||||