StabbyCutyou / generics

Package generics is the true way to program generically in golang
Apache License 2.0
193 stars 9 forks source link

G or interface{} is good? #23

Closed jmptrader closed 7 years ago

jmptrader commented 7 years ago

Dear, Good catch. I think that G is interface{} and looks like object (Java, c#) or variant of vb.

Dynamic o manually type checking is inevitable for now, i.e.

Not work was spected...

func Add(a G, b G) G { return a + b; } .... var ab := Add( 1, "test" ) ... Compiling ok, run fail without type check...

maybe you need to have a generic {} similar to interface {} but with type checking at compile time.

jmptrader commented 7 years ago

Already, please delete.