>
> I would probably never use it, like many people who comes to Go from C.


But if you use maps, slices, append, make, you are already using generics.

Maybe this is unfounded, but I'm far from convinced that generics would 
> make my experience of Go better. I'm really thinking here of, are we really 
> sure they would make large unfamiliar codebases more comprehensible? Every 
> feature of a language can be abused, so are they worth the abuse that they 
> would allow?


Sometimes having another built-in function would be helpful, and generics 
would provide a way to write those without changing the compiler. What I’ve 
seen is that built-in functions and new types expanding on the map/slice 
pattern will not make it into Go 2 without a major reason.

The other call for generics is interface{}. The Go 1 uses of interface{} 
can make strange code that maybe would be more comprehensible another way.

Matt

On Monday, February 19, 2018 at 9:50:53 AM UTC-6, Henrik Johansson wrote:
>
> I disagree that generics would decrease readability at the call site. 
> Perhaps within the library where it is used but maybe not even there. The 
> only complexity is within the compiler and other internals. This is not 
> irrelevant by far but the carte blanche "generics is bad" is most often 
> hyperbole.
>
> I can also "do without" generics and in fact even though Go lacks it I 
> prefer Go to all other languages that I know. I still would appreciate a 
> generics version in Go's spirit.
>
> On Mon, Feb 19, 2018, 16:06 Ignazio Di Napoli <necl...@gmail.com 
> <javascript:>> wrote:
>
>>
>> On Monday, February 19, 2018 at 4:04:12 PM UTC+1, Ignazio Di Napoli wrote:
>>>
>>>     data2 := found.(float32)   // THIS PANICS AT RUNTIME, data2 is int
>>>
>>
>> Sorry, found is int. 
>>
>> -- 
>> 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...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to