Closed jmptrader closed 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.
Already, please delete.
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.