Did Nim ever get anything like this?
Here's an example of the two null-safe features that are baked in most modern
languages (PHP, Groovy, Kotlin...)
someVariable?.someMethod("argument") ?: "otherwise"
| | |
| | | elvis operator: if the left-side is
not null,
| | | return its value and don't execute
the right side,
| | \_ otherwise execute it and return its
value
| |
| | null-safe call operator: if the left-side is null, the
procedure is never
| | called and the result of the expression is null or void,
depending on the
| \_ return value of someMethod (whether it's a nullable value or
void)
|
\_ a variable that can be null
Run