example:

type Key interface {
    type comparable, fmt.Stringer
}

type Value interface {
    type interface{}, copyable
}

type Container(type K Key, V Value) interface {
   Add(K, V) bool
}

type HashMap(type K Key, V Value) struct{ m map[K]V }

func (h *HashMap(K,V)) Add(k K, v V) bool {
    h.m[k] =v 
    return true
}

But of course, copyable isn't defined... So where to find some of these 
predefined constraints? Or if not, how could one define a such constraint?

Also how to specify constrains like

1. A type that I can call len() against it?
2. A type that I can range over it?

Thanks!

-- 
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/6118044d-05d2-4844-b713-5c5aa0caa9cfo%40googlegroups.com.

Reply via email to