I think the question was: "given your proposal here, I can write func (string | []byte in1, string | []byte in2) which enforces that in1 and in2 must be either of type string or type []byte, but how do I tell the compiler that in1 and in2 must be of the *same type* (whether it is string or []byte) ? "
Le mar. 19 janv. 2021 à 22:09, Kevin Chadwick <m8il1i...@gmail.com> a écrit : > 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. > > -- > 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/F183269A-E743-4069-90C3-0357F5C6D36D%40gmail.com > . > -- 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/CAL4P9zzcf4qg6wYkeRX6v%2BhOEtQSvm2kJnQM0_Pc_xZyS%3D_AhA%40mail.gmail.com.