👋Go言語における式の評価文脈を理解する2021/03/03に公開2021/09/222件GotechDiscussionHajime Hoshi2021/03/03 (他にもあったら教えてください) 仕様によると blank identifier の場合もそうなるようです https://golang.org/ref/spec#Assignments If an untyped constant is assigned to a variable of interface type or the blank identifier, the constant is first implicitly converted to its default type. あとは switch 文: https://golang.org/ref/spec#Switch_statements If the switch expression evaluates to an untyped constant, it is first implicitly converted to its default type; DQNEO2021/03/03に更新Hoshi さん ご指摘ありがとうございます! blank identifier the blank identifier への代入ということは値が捨てられるだけなのに、型の仕様がちゃんと明記されてるのが面白いですね。 switch 文: 見逃してました。追記しておきます。 返信を追加
Hajime Hoshi2021/03/03 (他にもあったら教えてください) 仕様によると blank identifier の場合もそうなるようです https://golang.org/ref/spec#Assignments If an untyped constant is assigned to a variable of interface type or the blank identifier, the constant is first implicitly converted to its default type. あとは switch 文: https://golang.org/ref/spec#Switch_statements If the switch expression evaluates to an untyped constant, it is first implicitly converted to its default type; DQNEO2021/03/03に更新Hoshi さん ご指摘ありがとうございます! blank identifier the blank identifier への代入ということは値が捨てられるだけなのに、型の仕様がちゃんと明記されてるのが面白いですね。 switch 文: 見逃してました。追記しておきます。 返信を追加
DQNEO2021/03/03に更新Hoshi さん ご指摘ありがとうございます! blank identifier the blank identifier への代入ということは値が捨てられるだけなのに、型の仕様がちゃんと明記されてるのが面白いですね。 switch 文: 見逃してました。追記しておきます。
Discussion
仕様によると blank identifier の場合もそうなるようです
あとは switch 文:
Hoshi さん ご指摘ありがとうございます!
the blank identifier への代入ということは値が捨てられるだけなのに、型の仕様がちゃんと明記されてるのが面白いですね。
見逃してました。追記しておきます。