-
Notifications
You must be signed in to change notification settings - Fork 75
Alternative syntax #50
Comments
Having all three of those not be consistent is a problem; they’re conceptually the same kind of operator. |
Another variant, change point 1 too:
|
@ljharb all these cases are not the same. What is operator
So, if we are going to keep consistent, then we should write:
So, there is no consistence right now. |
The current proposal is After #48, the proposal will be In both cases, all three optional chaining operators are |
Hm, REAMDE is outdated... |
Syntax of function call (
foo?.()
) and accessing array element (array?.[i]
) is quite uggly. The reason as known - problems with parsing, because of ternary operator? :
, so we can't usefoo?()
andarray?[i]
.I suggest change syntax a bit, and make different operator
??
for function calls and array access.user?.address?.street
- no changesmyForm.checkValidity??()
instead ofmyForm.checkValidity?.()
myArray??[i]
instead ofmyArray?.[i]
It's looks nice and has no problem with parsing. What do you think?
The text was updated successfully, but these errors were encountered: