Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match on more than just interface{} #13

jamesgarfield opened this issue Apr 15, 2015 · 0 comments

Match on more than just interface{} #13

jamesgarfield opened this issue Apr 15, 2015 · 0 comments


Copy link

@jamesgarfield jamesgarfield commented Apr 15, 2015

Provide the ability for metacode to specify an interface that must satisfied (beyond interface{}) to have a matching type. This will work in a somewhat analogous way to how Concepts are supposed to work in C++

E.g. Allow for code along the lines of to be generated

package set
type Elem interface {
    Hash() int64
    Equals(e Elem) bool

type _Set struct {
    buckets map[int64][]Elem
    size int

func New_Set() *Set { return &Set{make(map[int64][]Elem)} }
func (s *Set) Insert(v Elem) { ... }
func (s *Set) Remove(v Elem) { ... }
func (s *Set) Union(s *Set) *Set { ... }
func (s *Set) Count() int { ... }
func (s *Set) Contains(v Elem) bool { ... }
func (s *Set) ForEach(fn func(Elem)) { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.