On Wed, 12 Sep 2018 10:05:06 -0700
Ian Lance Taylor <i...@golang.org> wrote:

> a compile-time decision as to which code should be compiled.
Note that this decision making is needed only for outstanding cases
usually in user own code. For many generic implementation a simple
for type contract is enough:

// Sum method 

func (x type []K) Sum() (total type K) {
for type K range int64(), float64(), complex128() // whole contract

    for _, v := range x {
      total += v.Value
    }
    return
}

Sum func differs only in signature:

func Sum(x type []K) (total type K) {

> 
> Ian

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
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