5 ms·
>1. Maybe change the syntax to this one: >func eat(food []generic.Type) Or >func eat(food []g::type) Or something that doesn’t involve adding more <> or () I
by bno1 7y ago
>1. Maybe change the syntax to this one:
>func eat(food []generic.Type) Or
>func eat(food []g::type) Or something that doesn’t involve adding more <> or ()
I don't understand how this would work with multiple generic parameters. Say I have
func merge(a []g::type, b []g::type) []g::type
How do you specify that a, b and the returned value must have the same type and implement the comparison operators?
Also, why are people trying so hard to stay away from < and >?
- baby 7y ago“type” here is whatever you want it to be func merge(a []g::thing, b []g::thing) []g::otherThing The <> syntax is well accepted, that’s the only thing it has. What’s annoying is that it adds to the function signature when it’s not necessary.