What do you call the := operator?

Viewed 463

I was learning about Go and was wondering if there is a name for the := operator. As in x := 4.

The best I can come up with is the "spider face".

Example

enter image description here
(source: buzzfed.com)

Update

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? So far I have "ex colon equals four" or "ex spider-face four"? Are there any better ideas?

5 Answers

According to the specification at https://golang.org/ref/spec#Operators, Operators combine operands into expressions., this is definitely not an operator. (if you are unsure what exactly is an operand or an expression, figure out it can not combine. Otherwise, always check the spec https://golang.org/ref/spec#Expressions).

The paragraph about this aspect of the language available in the specification https://golang.org/ref/spec#Short_variable_declarations does not name it.

The same paragraph available in the Effective Go does not name it either, https://golang.org/doc/effective_go#redeclaration

Searching the source, i was available to find how it is defined.

https://cs.opensource.google/go/go/+/master:src/go/token/token.go;drc=master;l=80

I came to the conclusion that it is the define token.

Related