tc39 / proposal-optional-chaining

https://tc39.github.io/proposal-optional-chaining/
4.94k stars 75 forks source link

considering the note #8

Closed GrosSacASac closed 7 years ago

GrosSacASac commented 7 years ago

in the readme, would it be a good idea to use another symbol, other than ?. ? maybe this one #

ljharb commented 7 years ago

That one is taken by private fields, and doesn't connote "optional" in any way imo.

xtuc commented 7 years ago

I agree with @ljharb.

I prefer a?.b?.c rather than a#b#c. It has a more explicit syntax for optionnal and it is comparable to other languages.

Since it's used by private fiels, in case you write this.#a there would be no way to make the difference.

Mouvedia commented 7 years ago

# is commonly used to denote instance methods.

ljharb commented 7 years ago

Swapping # for @ between decorators and private fields (which would have addressed "denote instance methods") was rejected by TC39.

claudepache commented 7 years ago

The ?. token is one of the most commonly used token amongst different languages for that purpose. Why do you want to use another symbol?

GrosSacASac commented 7 years ago

I was considering the note

gisenberg commented 7 years ago

@GrosSacASac I'm not sure I follow. What note are you referring to, specifically? Or are you asking for one in which an alternate possible syntax is proposed?

Mouvedia commented 7 years ago

Swapping # for @ between decorators and private fields (which would have addressed "denote instance methods") was rejected by TC39.

@ljharb Well at least it's object.#a and not object#a.