If I have
func F[type E interface{}, S constraints.Slice[E]]() S
are the following equivalent:
F[int, []int]
F[int]
F[[]int]
or are only 2 of the 3 permissible? Does that change if I swap the
type parameters?
On Thu, Aug 13, 2020 at 4:31 PM Michael Jones <[email protected]> wrote:
>
> Yes, thank you. In intellectual shame I must say that I somehow understood
> that the generics needed to be "leaf" functions. Thank you for demonstrating
> my oversight. Happier now.
>
> Michael
>
> On Thu, Aug 13, 2020 at 3:47 PM Bakul Shah <[email protected]> wrote:
>>
>> On Aug 13, 2020, at 3:29 PM, Michael Jones <[email protected]> wrote:
>> >
>> > The all-or-none aspect would be sidestepped if it were allowed to define
>> > "partial generics":
>> >
>> > func A (T1, T2) (...){....}
>> >
>> > func B(T)(...){ A(T,int)(...){...} }
>> >
>> > Allowing B to exist just means running the whole generic thing iteratively
>> > until no resolution is changed. If the fixed point still has generic types
>> > then the compilation is a failure, otherwise, a success.
>>
>> Do you mean something like this? https://go2goplay.golang.org/p/4I4y-dLC-Yp
>>
>> >
>> > Seems useful to me. A generic balanced tree infrastructure could be
>> > "meta-instantiated" as a LLRB instance that still allows generic leaf
>> > types.
>>
>
>
> --
> Michael T. Jones
> [email protected]
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CALoEmQxTgQdhS2x4MU%3D_FcwBAJ09D68XnNYOQxy5YV7%2B6QOi0w%40mail.gmail.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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/CANG3jXJ60zyaBsYmvOSJdgX3J%3DaB0_Taz2SnuM31Rg3N0bx8mw%40mail.gmail.com.