5 ms·
Interesting. I think I saw this in Swift? Or c#? I guess in Python this is where EAFP comes in. I definitely hate chains of guards to get at a nested property.
by Waterluvian 8y ago
Interesting. I think I saw this in Swift? Or c#? I guess in Python this is where EAFP comes in.
I definitely hate chains of guards to get at a nested property.
- kreetx 8y agoIn haskell the lens library does this -- it's a useful feature to have.
- mattferderer 8y agoC# has it.
- nathanaldensr 8y agoYep, they're called null conditional operators[1]. [1]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-conditional-operators https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...
- LocalPCGuy 8y agoQuite a few language have this feature, and it is a Stage 1 proposal to become a part of the JS spec
- tijs 8y agohttps://en.wikipedia.org/wiki/Option_type https://en.wikipedia.org/wiki/Option_type