Hacker News new | ask | show | jobs
by o_____________o 4152 days ago
> The existential operator `?` soaks up null/undefined references.

This seemingly minor feature is so huge for me. Accessing deep objects?.is?.a?.horrible?.pain?.sometimes?()

1 comments

If you're accessing objects that deeply, something is breaking the Law of Demeter about locality of reference and looseness of coupling.

It's a syntactic convenience, but it leads to questionable patterns. Do you really want to silently collapse the hierarchy of whatever was null? I'd rather identify it and fail with a specific message or behavior rather than generically.