Allowing this implicit conversion would be a bad thing? because it works
like generics without any new syntax.

Also, I found this a little messy

type Ordered interface {
        type int, int8, int16, int32, int64,
                uint, uint8, uint16, uint32, uint64, uintptr,
                float32, float64,
                string}


Why not after interface?

type Ordered interface type {
        int, int8, int16, int32, int64,
        uint, uint8, uint16, uint32, uint64,
        byte, rune, uintptr,
        float32, float64,
        string,}


Sorry, I am pretty new to this, so probably the answers might be really
obvious 😅

On Wed, Jun 17, 2020 at 4:37 AM David Anderson <d...@natulte.net> wrote:

> The non-generic form _only_ accepts an argument of type []Stringer. If you
> have a []Foo, where Foo implements Stringer, that's not good enough. You
> will have to construct a []Stringer explicitly, and copy each Foo into that
> []Stringer. This is a fairly common gotcha with Go, where folks expect the
> implicit conversion to happen.
>
> OTOH, the generic form will accept []Foo directly, since Foo satisfies the
> Stringer constraint.
>
> - Dave
>
> On Wed, Jun 17, 2020 at 1:20 AM Christophe Meessen <
> christophe.mees...@gmail.com> wrote:
>
>> Reading the document "Type parameters - Draft desing" of June 16, 2020 (
>> https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md),
>> I wonder if these two following function definitions are not equivalent and
>> thus interchangeable
>>
>> func Stringify(type T Stringer)(s []T) (ret []string)
>>
>> func Stringify(s []Stringer) (ret []string)
>>
>> If the constrain is an interface, wouldn’t it be the same as to use the 
>> interface as type ? How would it be different ?
>>
>> --
>> 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/3b758827-2d14-4769-bf94-95cf60a06b1bo%40googlegroups.com
>> <https://groups.google.com/d/msgid/golang-nuts/3b758827-2d14-4769-bf94-95cf60a06b1bo%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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAMx%2Br7Vc9pLY63qJg1ek4ZrYq8YMyJFOLwzN5aLA6T8nho16Ww%40mail.gmail.com
> <https://groups.google.com/d/msgid/golang-nuts/CAMx%2Br7Vc9pLY63qJg1ek4ZrYq8YMyJFOLwzN5aLA6T8nho16Ww%40mail.gmail.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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAF9DLCm%3D0DSjRk2quhh%3D3L_eUH9%2BuxPXp6-8mzh%3DjZ0csy9rwQ%40mail.gmail.com.

Reply via email to