On Tue, 2021-01-19 at 21:09 +0000, Kevin Chadwick wrote: > On January 19, 2021 8:22:01 PM UTC, 'Dan Kortschak' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > On Tue, 2021-01-19 at 20:01 +0000, Kevin Chadwick wrote: > > > I was inquiring about the possibility of no identifiers or > > > abstraction but simply like Gos non generic functions (possibly > > > reversed if needed). Using type OR type. > > > > > > func (String | []byte firstInput, myType | publicKey > > > secondInput) { > > > > > > firstInput[0] > > > firstInput[[]byte] > > > } > > > > > > How does this encode the desire that parameter types match? > > These are the parameters. dynamic var firstInput must be a String or > byte slice.
Yeah, that doesn't answer the question. How do you make sure that types match where you have more than one parameter where the types must match? func find(s, pattern string | []byte) (string | []byte) If find is looking for pattern in s and then returning it, how do you indicate to the compiler that typeof(s) == typeof(pattern) and how do you indicate what the return type is? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cf8b268b57abec5c45879dbcce70c80838206489.camel%40kortschak.io.