On Sat, Sep 8, 2018 at 5:54 AM, Wojciech S. Czarnecki <o...@fairbe.org> wrote:
> On Sat, 8 Sep 2018 03:59:45 -0700
> Ian Lance Taylor <i...@golang.org> wrote:
>
>>  Why is it useful to say "this polymorphic function may
>> only be instantiated with unsigned integer types?"
>
> E.g. because an algorithm needs this constraint.

OK, but, in general the Go type system is not very complex.  There are
many algorithms we write in Go today that have constraints on their
types that we can not implement.  For example, it is well known and
accepted that an interface type may permit a type that will not work
for the algorithm.  So perhaps I should say it this way: how much
complexity are we willing to tolerate to permit a polymorphic function
to forbid some type arguments?

To expand on that, I believe that we need a mechanism to set a lower
bound, if you will, on the type arguments: they have to implement
certain operations.  The question is whether we need a mechanism to
set an upper bound on type arguments, or whether it is sufficient to
rely on documentation.

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to