Created
January 19, 2017 17:21
-
-
Save DennyLoko/eb98a9532159448a3a1ad37ce80a4169 to your computer and use it in GitHub Desktop.
go-generics test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type F generics | |
func cornuz(a, b, c, d, e F) F { | |
return a | |
} | |
func main() { | |
fmt.Println("Go cornz") | |
cornuz(1, "2", 3.0, int32(4), uint64(5)) | |
cornuz(1, 2, 3, 4, 5) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type F interface{} | |
func cornuz(a, b, c, d, e F) F | |
func main() { | |
fmt.Println("Go cornz") | |
cornuz_of_int64_string_float64__(1, "2", 3.0, int32(4), uint64(5)) | |
cornuz_of_int64_int64_int64_int64_int64(1, 2, 3, 4, 5) | |
} | |
func cornuz_of_int64_string_float64__(a int64, b string, c float64, d , e ) F { | |
return a | |
} | |
func cornuz_of_int64_int64_int64_int64_int64(a int64, b int64, c int64, d int64, e int64) F { | |
return a | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment