Skip to content

Deprecate conditional operator ?/: #740

Closed
@Cat-sushi

Description

@Cat-sushi

Motivation

NNBD, which is introducing many notations with ?, makes the ternary operator ?/: an eyesore more and more. For example, when null aware subscribing operation has shape of a?[b], then {a?[b]:c} is ambiguous at least mentally. The same thing goes for invocation {a?(b):c}.
In addition some proposals such as #357 might make the situation worse and worse.
T?, ??, ...?, and so on are OK, but ...

Note

This issue is derived from #376 and #729.
This issue aims to alternate the ternaly operation a ? b : c.
This issue doesn't treat collection-if or if-statement, directly.

Candidates of syntax

if(a) b else c // 1
if(a, b, c) // 2
if(a : b : c) // 3
and more

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureProposed language feature that solves one or more problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions