On Thu, Aug 13, 2020 at 9:22 AM jimmy frasche <soapboxcic...@gmail.com> wrote:
>
> Would the constraints package have Pointer[E], Slice[E], and so on?

Good question.  I don't know.  We can certainly add them if we see
people using them.


> What happens if you have
>   type SC(type E I) interface {
>     type []E
>   }
> for some I? Generally it seems like something to avoid, but it would
> be needed for
>   type Map[type K comparable, V interface{}] interface {
>     type map[K]V
>   }
> at least. Are those checked at the same time as methods?

Yes.  Constraints are used for constraint type inference, which gives
us the final set of type arguments.  Only once the type arguments are
fully known do we check that the constraints are satisfied.  So, yes,
this happens at the same time that we verify that the type arguments
have any required methods.


> Do chains of constraints like
>  func F[type T interface{}, PT Setter2[T], SPT SC[PT]](xs SPT) SPT
>  func G[type T interface{}, PT Setter2[T], S0 SC[T], S1[PT]](xs S0) S1
> work?

Yes.  The algorithm loops until there is nothing left to do.


Thanks for the feedback.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcU_aD8%3Dw12-FPeiUNKcCe1DSOWLiH203ay6ZPikvO5U0Q%40mail.gmail.com.

Reply via email to