Replies: 1 comment
-
My opinion:
Meta: to me it feels like assertive programming is a hack for not type-safe (not "sound" enough) codebases. In perfect world your types express your invariant in a way, that is impossible to get invalid state. However, Neva is not Haskell and its type-system is intentionally limited, so we might need workarounds of this kind |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Several statically typed languages have functionality, which tells the compiler to treat a potentially empty value as non-empty. Here are some comparable features in other languages:
.unwrap()
!!
non-null assertion!
non-null assertion!
forced unwrapping!
null assertion!
null-forgivingWithout it you have to always explicitly handle both cases. Example:
With it you can assert that the value is non-empty, otherwise runtime will throw panic
Questions
Beta Was this translation helpful? Give feedback.
All reactions