[英]What do you call the := operator?
I was learning about Go and was wondering if there is a name for the :=
operator. 我正在学习Go,并想知道是否有一个名称
:=
运算符。 As in x := 4
. 如在
x := 4
。
The best I can come up with is the "spider face" . 我能想到的最好的就是“蜘蛛脸” 。
(source: buzzfed.com ) (来源: buzzfed.com )
The reason I ask is because I'm wondering how you would read the code out loud as in during a pair programming session. 我问的原因是因为我想知道如何在一对编程会话中大声读出代码。 It's been brought up that the official name of the operator is the "short variable declaration operator" but this is ironically too long of a name to be used frequently.
有人提出,运营商的官方名称是“短变量申报运营商”,但具有讽刺意味的是,这个名称经常使用太久了。
How would you read this x := 4
? 你怎么读这个
x := 4
? So far I have "ex colon equals four" or "ex spider-face four"? 到目前为止,我有“前冒号等于四”或“前蜘蛛面四”? Are there any better ideas?
还有更好的想法吗?
Go编程语言规范调用涉及的声明:=
“短变量声明。”因此,运算符将被称为“短变量声明运算符”。
Assign? 分配? Or 'is assigned'.
或者'被分配'。 Actually, I'd use 'assign' but I have to type at least 30 characters...
实际上,我使用'assign'但我必须键入至少30个字符...
What about "declare as" 怎么样“宣布为”
x := 4
You would say either: "declare ex as four" or "ex declared as four" 你会说:“声明ex为四”或“ex声明为四”
If that's written as 如果那是写的
var x = 4
It's also correct 这也是正确的
This is just off the top of my head, but I'd call it "instantiate". 这只是我的头脑,但我称之为“实例化”。 IMHO, assign is not a good choice as it confuses it with the Pascal assignment operator.
恕我直言,assign不是一个好选择,因为它将它与Pascal赋值运算符混淆。 Assign is also the verb used for the "=" in go and most other computer languages.
Assign也是go和大多数其他计算机语言中用于“=”的动词。
"decinit" might work as a short-hand and that has no other meaning that I know of. “decinit”可能是一个简短的手,而且我没有其他意义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.