There is a delimiter in 'chan int' -> ' ' (space)

I don't think it is a good assumption that "most generic types would only
have 1 type-parameter" (or 2, or 3, or any other arbitrary number for what
it's worth). Moreover, I don't think it is a good idea to assimilate
builtin language constructs to examples of "specific already-implemented
generics", precisely because they are not thought to be generics and they
are not used like generics.

Finally, and as for all that's written above, it is my own opinion, I think
the best rules are the simplest ones (in terms of description), and
*sometimes*, if it is "lose a little readability for simpler rules" or
"lose a little simplicity in rules for better readability", and those gains
/ losses are really small (which I think is the case with your suggestion),
the first choice should always be the right one. It'll only be a matter of
days for people to get used to the current syntax, after that, "brain
automation" takes on for such tasks and everything is okay without even
having to think about it. I don't like the idea of a "special rule" for the
last / only type-parameter.

Le mar. 5 janv. 2021 à 12:44, 'Anonymous AWK fan' via golang-nuts <
golang-nuts@googlegroups.com> a écrit :

> Axel, please send your reply to golang-nuts too, you can ignore the rest
> of this, I already sent it to you but not golang-nuts because I didn't
> reply to all.
>
> > What is the "them" to be omitted if there is only one type parameter? It
> wouldn't make sense to omit the brackets (because there needs to be some
> delimiter between the name of the generic function/type and the type
> argument). But if there is only one type-parameter anyway, I don't know
> what else you would omit.
>
> Why does there need to be a delimiter, there isn't one between chan and
> int in chan int, which I think is more readable than chan[int].
>
> > Either way - you are using `sync.Map` to motivate this, with a clear
> analogue to `map`. But what about types that *don't* represent a map (like
> the Graph-example, where both type-parameters are on mostly equal footing)?
>
> I think most generic types would only have 1 type-parameter and the syntax
> should be like the built-in ones ([]T, *T, func(Params) Result,
> map[Key]Elem and chan T). Putting the extra ones in square brackets is the
> best thing I can think of. Also I think Graph[Node]Edge or Graph[Edge]Node
> is still readable.
>
> > And what about generic functions? I think
> > Foo[int]string(bar, baz)
> > isn't super readable, TBH.
>
> I was only suggesting this for generic types.
>
> --
> 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/1794255551.562131.1609847012148%40ichabod.co-bxl
> .
>

-- 
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/CAL4P9zxTAE92Xzt7oxYQaGRj9eAqnT9%2B8qd6Dod5zR%2B_vGpLUA%40mail.gmail.com.

Reply via email to