I was asking for the rabbit, *erm Gopher*, hole, so there's a lot for me 
to learn here! Please be patient with me, I'm trying my best, but the the 
finer points in Go for me still escape much farther than the heap...

On Thursday, November 14, 2024 at 10:50:58 AM UTC+1 Axel Wagner wrote:

I would either just write "an iterator", or "a function assignable to 
iter.Seq or iter.Seq2". Assignability is a well-defined term that seems 
more precise than talking about a signature being "like" something.


Ah, thank you very much! I'll probably opt for the latter to put the 
specific iterator types right before a dev's eyes. Or alternatively put 
this in the beginning of the "Collections" subsection explaining it for 
once and all, and then just going for your short "an iterator".
 

Out of curiosity: From the documentation you quote, it seems that if I do 
`type MyString string`, that would not be allowed? Because that seems a 
strange restriction to me - but it also seems strange to me to go out of 
your way to include all the nuance when it comes to iter.Seq, but then not 
put that nuance into the documentation of any of the other types.


You are right (also with your curiosity), a value of type MyString is also 
accepted; how would you phrase that part, dropping the "of type" in the 
sentence "ACTUAL must be ..."? Does this sentence need more fixing? Or a 
bigger overhaul?
 

Like, you say "or `slice`", but `slice` is not a type, so presumably that 
means "any slice type"? Or does it mean something like "`[]T`, where `T` is 
any type" (so in particular not defined types). Or does it mean "a slice of 
some further constrained type"? Clearly there is ambiguity in the existing 
docs.


Expecting devs to have read "A Tour of Go"'s part about Slices 
<https://go.dev/tour/moretypes/7>, this would be "The type []T is a slice 
with elements of type T." Would the aforementioned dropping of "of type" 
also solve this?

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/4da34ec5-9282-4c3a-9e25-709184625f76n%40googlegroups.com.

Reply via email to