On Sat, Jun 20, 2020 at 8:35 AM T L <tapir....@gmail.com> wrote:
>
> And
> * should "embeddable" be one kind of constraints?
> * should "has some specified fields" be one kind of constraints?

Being able to express every possible language concept in a constraint
is not a goal.

Also, this kind of extension can typically be added later.

Ian


> On Saturday, June 20, 2020 at 11:26:08 AM UTC-4, T L wrote:
>>
>> For example, if there is a builtin convertible(from, to) constraint,
>> We can define a slice conversion function as
>>
>> func Convert(type Ta, Tb converitble(Ta, Tb)) (avs []Ta, _Tb) (bvs []Tb) {
>>    bvs = make([]Tb, 0, len(avs)
>>    for _, v := range avs {
>>       bvs = append(bvs, Tb(v))
>>    }
>>    return bvs
>> }
>>
>> We can use it as:
>>
>> iValues := Convert([]int{}{1, 2, 3}, interface{}(nil))
>
> --
> 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/1754a8a6-a496-4a51-bc3d-ddb2dc1be75ao%40googlegroups.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/CAOyqgcVrQob10fj4xuZ-fkqnh3T2W999YyT94X_TgGhUfTtzSA%40mail.gmail.com.

Reply via email to