On Tue, Aug 4, 2020 at 6:07 AM 'Carla Pfaff' via golang-nuts
<golang-nuts@googlegroups.com> wrote:

> On Tuesday, 4 August 2020 at 00:34:12 UTC+2 ben...@gmail.com wrote:

> I'm sure it would quickly become a well-known idiom, just like people know 
> that "error" is "interface{Error() string}" or "fmt.Stringer" is 
> "interface{String() string}".

I'm sure some people will never write `any` instead of `interface{}`
and I can prove it ;-)

> Actually the current use of "interface{}" is a bit odd because it is the only 
> case where an interface is commonly used as an anonymous type rather than by 
> an identifier.

It's not the only place. It does not happen often, but interface type
literals other than interface{} appear in real code and for good
reasons. It's an overkill to name a thing that will be referenced by
name only once.

> I assume that in current Go the empty interface is supposed to be an ugly 
> duckling to discourage its overuse, but in a world with type parameters it 
> will play an important role as the unbounded constraint and it should deserve 
> its own identifier.

It's not supposed to be anything special whatsoever. Just like number
zero or an empty set is not some kind of an exception. It's just you
cannot have any reasonable set theory without it.

BTW: I assume number 42 to be special, though not for math. Can I have
a nice Unicode point for it, so I can write it nicely all over my
example code?

> Most Go programmers want to be type safe and avoid casting.

Go programmers do avoid casting because Go has no casting. That word
or its stem doesn't even appear in the language specs.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-U%3DbwWGFX4MmMiD7jEhQHZY1XhmD3XmzwtVYPDTGpkESA%40mail.gmail.com.

Reply via email to