+=类似的赋值运算符需要加吗? #20
zhangzhimin
started this conversation in
Programming Language Design
Replies: 4 comments 1 reply
-
目前将其作为"可定义的运算符"肯定是不行的, 因为"+="是"+"的拓展, 定义了"+"就决定了"+="的行为. 我们可以讨论下引入一个语法糖是否必要? |
Beta Was this translation helpful? Give feedback.
0 replies
-
这个语法糖有必要,多数现代语言都包含它。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
将其实现为可定义运算符进行实现也需要认真考虑。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
设计好语法糖一来减轻使用者的心智负担,二来改善使用者的开发体验。 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
需要将其像C++一样作为一个可定义的运算符吗?
将其单纯等价于 "A += B" -> "A = A + B"的语法糖有必要吗?
Beta Was this translation helpful? Give feedback.
All reactions