Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Proposal: Drop optional call expressions #59

Description

@jridgewell

One of the biggest blockers for the "optimal" syntax ?. is the optional chain call ?.(. I hate it, and a few other delegates agree.

I don't, however, share the requirement that all three operators share the same base (the whole ??. operators). I think ?.[ is ugly, but it still means property access to me. Even in deep chaining sequences, it still makes sense to parse (compare this with my rant against ?.(:

obj.func?.[arg];

obj.func?.[arg].property;

obj.func?.[arg.property];

It's obviously not great, but it's not a total deal breaker for me.

So this leads to my proposal. Why not just drop the optional call entirely (to be clear, not the short-circuiting of method calls, just the ?.( optional call)? I don't have any major use cases for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions