On Saturday, June 20, 2020 at 10:21:56 AM UTC-4, Axel Wagner wrote:
>
> I would assume it's
>
> type MapConstraint(type K comparable, V interface{}) interface {
> type map[K]V
> }
>
> func F(type M MapConstraint(K, V), K comparable, V interface{}) (m M) {
> }
>
> Note that you are under no obligation to make use of a type-parameter if
> you don't need it.
>
I don't very understand this. Can a slice value be used as the argument of
the F function?
>
> On Sat, Jun 20, 2020 at 4:14 PM T L <[email protected] <javascript:>>
> wrote:
>
>> I mean I don't care about the element and key types of the parameter type.
>>
>> For a simple example, I want to define a generic function which prints
>> the length of a container (do do some other things):
>>
>> func Print(type T Container) (v T) {
>> // ... do some things
>>
>> fmt.Println(len(v))
>>
>> // ... do some things
>> }
>>
>> On Saturday, June 20, 2020 at 9:16:39 AM UTC-4, T L wrote:
>>>
>>> .
>>>
>> --
>> 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] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/4f42e5e9-f991-4ee7-a043-5350a62f787fo%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/golang-nuts/4f42e5e9-f991-4ee7-a043-5350a62f787fo%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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/f841c497-8c29-4f16-a027-2c446f1a94b6o%40googlegroups.com.