Skip to content

Multisignatures #12

@kirillDanshin

Description

@kirillDanshin

Let's say we have this struct:

type SomeStore struct {
    b int
    c string
    d float64
}

User should be able to define functions like:

func Store(n int) *SomeStore {
    return &SomeStore{b: n}
}
func Store(c string) *SomeStore {
    return &SomeStore{c: c}
}
func Store(d float64) *SomeStore {
    return &SomeStore{d: d}
}

And methods:

func (s *SomeStore) Set(n int) {
    s.b = n
}
func (s *SomeStore) Set(c string) {
    s.c = c
}
func (s *SomeStore) Set(d float64) {
    s.d = d
}

And more on methods:

func (a *A) Set(anotherA *A) {
    a.b = anotherA.b
    a.c = anotherA.c
    a.d = anotherA.d
}
func (a *A) Set(c string) {
    a.Set(15<<2, c)
}
func (a *A) Set(c int, d string) {
    a.b = c
    a.c = d
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions