Hacker News new | ask | show | jobs
by Waterluvian 2667 days 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.

4 comments

In haskell the lens library does this -- it's a useful feature to have.
Quite a few language have this feature, and it is a Stage 1 proposal to become a part of the JS spec
C# has it.
Yep, they're called null conditional operators[1].

[1]: https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...