SlideShare a Scribd company logo
1 of 352
Rou
                                        gh
                                   Cut
                                       !

       Google Go
        for Ruby Hackers



          Eleanor McHugh

http://slides.games-with-brains.net/
Go                       Ruby

compilation        static AOT            runtime mutable

 memory                     garbage collected

  syntax           minimalist               humanistic

                            strong dynamic
   type
                   embedding               inheritance

 dispatch     procedural invocation      message passing

semantics         statements               expressions
minimalist
package
organisation                    import

                           var, const, type
declaration
                 func, interface, map, struct, chan


                                if ... else
               switch ... case ... fallthrough ... default
                             select ... case
control flow                         for
                              for ... range
                           break, continue
                        go, goto, defer, return
boolean, numeric, array

  value
                    structure, interface



reference    pointer, slice, string, map, channel



invocation       function, method, closure
package main

import “fmt”

const HELLO string = “hello”
var WORLD string = “world”

func main() {
     fmt.Println(HELLO, WORLD)
}
package main

import “fmt”

const HELLO string = “hello”
var WORLD string = “world”

func main() {
     fmt.Println(HELLO, WORLD)
}
package main

import “fmt”

const HELLO string = “hello”
var WORLD string = “world”

func main() {
     fmt.Println(HELLO, WORLD)
}
package main

import “fmt”

const HELLO string = “hello”
var WORLD string = “world”

func main() {
     fmt.Println(HELLO, WORLD)
}
type in Ruby
class Counter
     attr_writer :count

      def initialize
           @count = 0
      end

      def Tick
           @count += 1
      end
end

class DoubleCounter < Counter
     def Tick
          super
          @count += 1
     end
end

n = new(DoubleCounter)
puts n.Tick
puts n.superclass.Tick
instance               inherited
  class                  class
           expressed
             type
class Counter
     attr_writer :count

      def initialize
           @count = 0
      end

      def Tick
           @count += 1
      end
end

class DoubleCounter < Counter
     def Tick
          super
          @count += 1
     end
end

n = new(DoubleCounter)
puts n.Tick
puts n.superclass.Tick
instance               inherited
  class                  class
           expressed
             type
class Counter
     attr_writer :count

      def initialize
           @count = 0
      end

      def Tick
           @count += 1
      end
end

class DoubleCounter < Counter
     def Tick
          super
          @count += 1
     end
end

n = new(DoubleCounter)
puts n.Tick
puts n.superclass.Tick
instance               inherited
  class                  class
           expressed
             type
class Counter
     attr_writer :count

      def initialize
           @count = 0
      end

      def Tick
           @count += 1
      end
end

class DoubleCounter < Counter
     def Tick
          super
          @count += 1
     end
end

n = new(DoubleCounter)
puts n.Tick
puts n.superclass.Tick
class Counter
     attr_writer :count

      def initialize
           @count = 0
      end

      def Tick
           @count += 1
      end
end

class DoubleCounter < Counter
     def Tick
          super
          @count += 1
     end
end

n = new(DoubleCounter)
puts n.Tick
puts n.superclass.Tick
class Counter
     attr_writer :count

      def initialize
           @count = 0
      end

      def Tick
           @count += 1
      end
end

class DoubleCounter < Counter
     def Tick
          super
          @count += 1
     end
end

n = new(DoubleCounter)
puts n.Tick
puts n.superclass.Tick
instance               inherited
  class                  class

           expressed
             type




           modules
superclass   modules



class        modules


                   message
        instance
superclass   modules



         class        modules


type asserted
                 instance
down a rabbit hole


instances are their own classes
down a rabbit hole


instances are their own classes
and all classes are mutable at runtime
down a rabbit hole

instances are their own classes
all classes are mutable at runtime
so inheritance pathways can be altered
down a rabbit hole

instances are their own classes
and all classes are mutable at runtime
so inheritance pathways can be altered
making Ruby very flexible
down a rabbit hole
instances are their own classes
and all classes are mutable at runtime
so inheritance pathways can be altered
making Ruby very flexible
at the cost of type uncertainty
down a rabbit hole
instances are their own classes
and all classes are mutable at runtime
so inheritance pathways can be altered
making Ruby very flexible
at the cost of type uncertainty
which really bugs computer scientists
type in Go
package Integer

type Int int

func (i *Int) Add(x int) {
     *i += Int(x)
}
memory           method
          type
 layout           set
package Integer

type Int int

func (i *Int) Add(x int) {
     *i += Int(x)
}
memory           method
          type
 layout           set
package Integer

type Int int

func (i *Int) Add(x int) {
     *i += Int(x)
}
memory    static   method
 layout    type     set
package Integer

type Int int

func (i *Int) Add(x int) {
     *i += Int(x)
}
type Buffer []Int

func (b Buffer) Swap(i, j int) {
     b[i], b[j] = b[j], b[i]
}

func (b Buffer) Clone() Buffer {
     s := make(Buffer, len(b))
     copy(s, b)
     return s
}

func (b Buffer) Move(i, n int) {
     if n > len(b) - i {
           n = len(b) - i
     }
     segment_to_move := b[:i].Clone()
     copy(b, b[i:i + n])
     copy(b[n:i + n], segment_to_move)
}
type Buffer []Int

func (b Buffer) Swap(i, j int) {
     b[i], b[j] = b[j], b[i]
}

func (b Buffer) Clone() Buffer {
     s := make(Buffer, len(b))
     copy(s, b)
     return s
}

func (b Buffer) Move(i, n int) {
     if n > len(b) - i {
           n = len(b) - i
     }
     segment_to_move := b[:i].Clone()
     copy(b, b[i:i + n])
     copy(b[n:i + n], segment_to_move)
}
type Buffer []Int

func (b Buffer) Swap(i, j int) {
     b[i], b[j] = b[j], b[i]
}

func (b Buffer) Clone() Buffer {
     s := make(Buffer, len(b))
     copy(s, b)
     return s
}

func (b Buffer) Move(i, n int) {
     if n > len(b) - i {
           n = len(b) - i
     }
     segment_to_move := b[:i].Clone()
     copy(b, b[i:i + n])
     copy(b[n:i + n], segment_to_move)
}
package main

import “fmt”
import "Integer"

func main() {
     i := Integer.Buffer{0, 1, 2, 3, 4, 5}   produces:
     b := i.Clone()                             b[0:2] = [6 4]
     b.Swap(1, 2)
     b.Move(3, 2)
     b[0].Add(3)
     fmt.Printf(“b[0:2] = %vn”, b[:2])
}
package main

import “fmt”
import "Integer"

func main() {
     i := Integer.Buffer{0, 1, 2, 3, 4, 5}   produces:
     b := i.Clone()                             b[0:2] = [6 4]
     b.Swap(1, 2)
     b.Move(3, 2)
     b[0].Add(3)
     fmt.Printf(“b[0:2] = %vn”, b[:2])
}
package main

import “fmt”
import "Integer"

func main() {
     i := Integer.Buffer{0, 1, 2, 3, 4, 5}   produces:
     b := i.Clone()                             b[0:2] = [6 4]
     b.Swap(1, 2)
     b.Move(3, 2)
     b[0].Add(3)
     fmt.Printf(“b[0:2] = %vn”, b[:2])
}
package main

import “fmt”
import "Integer"

func main() {
     i := Integer.Buffer{0, 1, 2, 3, 4, 5}   produces:
     b := i.Clone()                             b[0:2] = [6 4]
     b.Swap(1, 2)
     b.Move(3, 2)
     b[0].Add(3)
     fmt.Printf(“b[0:2] = %vn”, b[:2])
}
package main

import “fmt”
import "Integer"

func main() {
     i := Integer.Buffer{0, 1, 2, 3, 4, 5}   produces:
     b := i.Clone()                             b[0:2] = [6 4]
     b.Swap(1, 2)
     b.Move(3, 2)
     b[0].Add(3)
     fmt.Printf(“b[0:2] = %vn”, b[:2])
}
package Vector
import . "Integer"

type Vector struct {
    Buffer
}

func (v *Vector) Clone() *Vector {
     return &Vector{v.Buffer.Clone()}
}

func (v *Vector) Slice(i, j int) Buffer {
     return v.Buffer[i:j]
}
package Vector
import . "Integer"

type Vector struct {
    Buffer
}

func (v *Vector) Clone() *Vector {
     return &Vector{v.Buffer.Clone()}
}

func (v *Vector) Slice(i, j int) Buffer {
     return v.Buffer[i:j]
}
package Vector
import . "Integer"

type Vector struct {
    Buffer
}

func (v *Vector) Clone() *Vector {
     return &Vector{v.Buffer.Clone()}
}

func (v *Vector) Slice(i, j int) Buffer {
     return v.Buffer[i:j]
}
package Vector
import . "Integer"

type Vector struct {
    Buffer
}

func (v *Vector) Clone() *Vector {
     return &Vector{v.Buffer.Clone()}
}

func (v *Vector) Slice(i, j int) Buffer {
     return v.Buffer[i:j]
}
package Vector
import . "Integer"

type Vector struct {
    Buffer
}

func (v *Vector) Clone() *Vector {
     return &Vector{v.Buffer.Clone()}
}

func (v *Vector) Slice(i, j int) Buffer {
     return v.Buffer[i:j]
}
memory               method
 layout               set

           static
            type




          embedded
           types
now the clever bit
type Adder interface {
    Add(j int)
    Subtract(j int)
    Result() interface{}
    Reset()
}
type Adder interface {
    Add(j int)
    Subtract(j int)
    Result() interface{}
    Reset()
}
type Adder interface {
    Add(j int)
    Subtract(j int)
    Result() interface{}
    Reset()
}
type IAdder int

func (i IAdder) Add(j int) {
     i[0] += i[j]
}

func (i IAdder) Subtract(j int) {
     i[0] -= i[j]
}

func (i IAdder) Result() interface{} {
     return i[0]
}

func (i IAdder) Reset() {
     i[0] = *new(int)
}

func (i IAdder) Increment() {
     i[0]++
}
type IAdder int

func (i IAdder) Add(j int) {
     i[0] += i[j]
}

func (i IAdder) Subtract(j int) {
     i[0] -= i[j]
}

func (i IAdder) Result() interface{} {
     return i[0]
}

func (i IAdder) Reset() {
     i[0] = *new(int)
}

func (i IAdder) Increment() {
     i[0]++
}
type IAdder int

func (i IAdder) Add(j int) {
     i[0] += i[j]
}

func (i IAdder) Subtract(j int) {
     i[0] -= i[j]
}

func (i IAdder) Result() interface{} {
     return i[0]
}

func (i IAdder) Reset() {
     i[0] = *new(int)
}

func (i IAdder) Increment() {
     i[0]++
}
type IAdder int

func (i IAdder) Add(j int) {
     i[0] += i[j]
}

func (i IAdder) Subtract(j int) {
     i[0] -= i[j]
}

func (i IAdder) Result() interface{} {
     return i[0]
}

func (i IAdder) Reset() {
     i[0] = *new(int)
}

func (i IAdder) Increment() {
     i[0]++
}
type IAdder int

func (i IAdder) Add(j int) {
     i[0] += i[j]
}

func (i IAdder) Subtract(j int) {
     i[0] -= i[j]
}

func (i IAdder) Result() interface{} {
     return i[0]
}

func (i IAdder) Reset() {
     i[0] = *new(int)
}

func (i IAdder) Increment() {
     i[0]++
}
type FAdder []float32

func (f FAdder) Add(j int) {
     f[0] += f[j]
}

func (f FAdder) Subtract(j int) {
     f[0] -= f[j]
}

func (f FAdder) Result() interface{} {
     return f[0]
}

func (f FAdder) Reset() {
     f[0] = 0
}
type FAdder []float32

func (f FAdder) Add(j int) {
     f[0] += f[j]
}

func (f FAdder) Subtract(j int) {
     f[0] -= f[j]
}

func (f FAdder) Result() interface{} {
     return f[0]
}

func (f FAdder) Reset() {
     f[0] = 0
}
type FAdder []float32

func (f FAdder) Add(j int) {
     f[0] += f[j]
}

func (f FAdder) Subtract(j int) {
     f[0] -= f[j]
}

func (f FAdder) Result() interface{} {
     return f[0]
}

func (f FAdder) Reset() {
     f[0] = 0
}
func TestAdder(t *testing.T) {
     var a   Adder

    a = IAdder{0, 1, 2}
    a.Add(1)
    if i.Result().(int) != 1 {
          t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1)
    }
    a.Subtract(2)
    if a.Result().(int) != -1 {
          t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1)
    }

    a = FAdder{0.0, 1.0, 2.0}
    a.Add(1)
    if a.Result().(float32) != 1.0 {
          t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0)
    }
}
func TestAdder(t *testing.T) {
     var a   Adder

    a = IAdder{0, 1, 2}
    a.Add(1)
    if i.Result().(int) != 1 {
          t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1)
    }
    a.Subtract(2)
    if a.Result().(int) != -1 {
          t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1)
    }

    a = FAdder{0.0, 1.0, 2.0}
    a.Add(1)
    if a.Result().(float32) != 1.0 {
          t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0)
    }
}
func TestAdder(t *testing.T) {
     var a   Adder

    a = IAdder{0, 1, 2}
    a.Add(1)
    if i.Result().(int) != 1 {
          t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1)
    }
    a.Subtract(2)
    if a.Result().(int) != -1 {
          t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1)
    }

    a = FAdder{0.0, 1.0, 2.0}
    a.Add(1)
    if a.Result().(float32) != 1.0 {
          t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0)
    }
}
func TestAdder(t *testing.T) {
     var a   Adder

    a = IAdder{0, 1, 2}
    a.Add(1)
    if i.Result().(int) != 1 {
          t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1)
    }
    a.Subtract(2)
    if a.Result().(int) != -1 {
          t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1)
    }

    a = FAdder{0.0, 1.0, 2.0}
    a.Add(1)
    if a.Result().(float32) != 1.0 {
          t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0)
    }
}
func TestAdder(t *testing.T) {
     var a   Adder

    a = IAdder{0, 1, 2}
    a.Add(1)
    if i.Result().(int) != 1 {
          t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1)
    }
    a.Subtract(2)
    if a.Result().(int) != -1 {
          t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1)
    }

    a = FAdder{0.0, 1.0, 2.0}
    a.Add(1)
    if a.Result().(float32) != 1.0 {
          t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0)
    }
}
func TestAdder(t *testing.T) {
     var a   Adder

    a = IAdder{0, 1, 2}
    a.Add(1)
    if i.Result().(int) != 1 {
          t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1)
    }
    a.Subtract(2)
    if a.Result().(int) != -1 {
          t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1)
    }

    a = FAdder{0.0, 1.0, 2.0}
    a.Add(1)
    if a.Result().(float32) != 1.0 {
          t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0)
    }
}
func TestAdder(t *testing.T) {
     var a   Adder

    a = IAdder{0, 1, 2}
    a.Add(1)
    if i.Result().(int) != 1 {
          t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1)
    }
    a.Subtract(2)
    if a.Result().(int) != -1 {
          t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1)
    }

    a = FAdder{0.0, 1.0, 2.0}
    a.Add(1)
    if a.Result().(float32) != 1.0 {
          t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0)
    }
}
down a rabbit hole


an object has known static type
down a rabbit hole


an object has known static type
this fixed type is determined at linking
down a rabbit hole

an object has known static type
this fixed type is determined at linking
no new types can be created at runtime
down a rabbit hole

an object has known static type
this fixed type is determined at linking
no new types can be created at runtime
so dynamism is bounded to a fixed set
down a rabbit hole
an object has known static type
this fixed type is determined at linking
no new types can be created at runtime
so dynamism is bounded to this fixed set
and computer scientists are happier
testing
func (b Buffer) Eq(o Buffer) (r bool) {
     if len(b) == len(o) {
           for i := len(b) - 1; i > 0; i-- {
                 if b[i] != o[i] {
                       return
                 }
           }
           r = true
     }
     return
}
func (b Buffer) Eq(o Buffer) (r bool) {
     if len(b) == len(o) {
           for i := len(b) - 1; i > 0; i-- {
                 if b[i] != o[i] {
                       return
                 }
           }
           r = true
     }
     return
}
func (b Buffer) Eq(o Buffer) (r bool) {
     if len(b) == len(o) {
           for i := len(b) - 1; i > 0; i-- {
                 if b[i] != o[i] {
                       return
                 }
           }
           r = true
     }
     return
}
func (b Buffer) Eq(o Buffer) (r bool) {
     if len(b) == len(o) {
           for i := len(b) - 1; i > 0; i-- {
                 if b[i] != o[i] {
                       return
                 }
           }
           r = true
     }
     return
}
func (b Buffer) Eq(o Buffer) (r bool) {
     if len(b) == len(o) {
           for i := len(b) - 1; i > 0; i-- {
                 if b[i] != o[i] {
                       return
                 }
           }
           r = true
     }
     return
}
func (b Buffer) Eq(o Buffer) (r bool) {
     if len(b) == len(o) {
           for i := len(b) - 1; i > 0; i-- {
                 if b[i] != o[i] {
                       return
                 }
           }
           r = true
     }
     return
}
func (b Buffer) Eq(o Buffer) (r bool) {
     if len(b) == len(o) {
           for i := len(b) - 1; i > 0; i-- {
                 if b[i] != o[i] {
                       return
                 }
           }
           r = true
     }
     return
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):     fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):     fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):     fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):           fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):           fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):           fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):           fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
package Vector

import "testing"

func TestVectorSwap(t *testing.T) {
     i := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     v := i.Clone()
     v.Swap(1, 2)
     r := Vector{Buffer{0, 2, 1, 3, 4, 5}}
     switch {
     case !v.Eq(r.Buffer):           fallthrough
     case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v)
     }
}
include $(GOROOT)/src/Make.inc

TARG=integer

GOFILES=
    integer.go
    vector.go

include $(GOROOT)/src/Make.pkg
package Vector

import "testing"
import "vector"

func BenchmarkVectorClone6(b *testing.B) {
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     for i := 0; i < b.N; i++ {
           _ = v.Clone()
     }
}

func BenchmarkVectorSwap(b *testing.B) {
     b.StopTimer()
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     b.StartTimer()
     for i := 0; i < b.N; i++ {
           v.Swap(1, 2)
     }
}
package Vector

import "testing"
import "vector"

func BenchmarkVectorClone6(b *testing.B) {
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     for i := 0; i < b.N; i++ {
           _ = v.Clone()
     }
}

func BenchmarkVectorSwap(b *testing.B) {
     b.StopTimer()
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     b.StartTimer()
     for i := 0; i < b.N; i++ {
           v.Swap(1, 2)
     }
}
package Vector

import "testing"
import "vector"

func BenchmarkVectorClone6(b *testing.B) {
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     for i := 0; i < b.N; i++ {
           _ = v.Clone()
     }
}

func BenchmarkVectorSwap(b *testing.B) {
     b.StopTimer()
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     b.StartTimer()
     for i := 0; i < b.N; i++ {
           v.Swap(1, 2)
     }
}
package Vector

import "testing"
import "vector"

func BenchmarkVectorClone6(b *testing.B) {
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     for i := 0; i < b.N; i++ {
           _ = v.Clone()
     }
}

func BenchmarkVectorSwap(b *testing.B) {
     b.StopTimer()
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     b.StartTimer()
     for i := 0; i < b.N; i++ {
           v.Swap(1, 2)
     }
}
package Vector

import "testing"
import "vector"

func BenchmarkVectorClone6(b *testing.B) {
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     for i := 0; i < b.N; i++ {
           _ = v.Clone()
     }
}

func BenchmarkVectorSwap(b *testing.B) {
     b.StopTimer()
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     b.StartTimer()
     for i := 0; i < b.N; i++ {
           v.Swap(1, 2)
     }
}
package Vector

import "testing"
import "vector"

func BenchmarkVectorClone6(b *testing.B) {
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     for i := 0; i < b.N; i++ {
           _ = v.Clone()
     }
}

func BenchmarkVectorSwap(b *testing.B) {
     b.StopTimer()
     v := Vector{Buffer{0, 1, 2, 3, 4, 5}}
     b.StartTimer()
     for i := 0; i < b.N; i++ {
           v.Swap(1, 2)
     }
}
$ gotest -bench="Benchmark"
rm -f _test/scripts.a
6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go
embedded_typing_benchmark_test.go embedded_typing_test.go
rm -f _test/scripts.a
gopack grc _test/scripts.a _gotest_.6
PASS
integer.BenchmarkVectorSwap 200000000                8 ns/op
integer.BenchmarkVectorClone6 10000000              300 ns/op
$ gotest -bench="Benchmark"
rm -f _test/scripts.a
6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go
embedded_typing_benchmark_test.go embedded_typing_test.go
rm -f _test/scripts.a
gopack grc _test/scripts.a _gotest_.6
PASS
integer.BenchmarkVectorSwap 200000000                8 ns/op
integer.BenchmarkVectorClone6 10000000              300 ns/op
$ gotest -bench="Benchmark"
rm -f _test/scripts.a
6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go
embedded_typing_benchmark_test.go embedded_typing_test.go
rm -f _test/scripts.a
gopack grc _test/scripts.a _gotest_.6
PASS
integer.BenchmarkVectorSwap 200000000                8 ns/op
integer.BenchmarkVectorClone6 10000000              300 ns/op
$ gotest -bench="Benchmark"
rm -f _test/scripts.a
6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go
embedded_typing_benchmark_test.go embedded_typing_test.go
rm -f _test/scripts.a
gopack grc _test/scripts.a _gotest_.6
PASS
integer.BenchmarkVectorSwap 200000000                8 ns/op
integer.BenchmarkVectorClone6 10000000              300 ns/op
$ gotest -bench="Benchmark"
rm -f _test/scripts.a
6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go
embedded_typing_benchmark_test.go embedded_typing_test.go
rm -f _test/scripts.a
gopack grc _test/scripts.a _gotest_.6
PASS
integer.BenchmarkVectorSwap 200000000                8 ns/op
integer.BenchmarkVectorClone6 10000000              300 ns/op
Go is reflected
package generalise

import "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := reflect.ValueOf(i); v.Kind() {
     case reflect.Slice:        l := v.Cap()
                               if len(limit) > 0 {
                                      l = limit[0]
                               }
                               n = reflect.MakeSlice(v.Type(), l, l).Interface()

     case reflect.Map:          n = reflect.MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := reflect.ValueOf(i); v.Kind() {
     case reflect.Slice:        l := v.Cap()
                               if len(limit) > 0 {
                                      l = limit[0]
                               }
                               n = reflect.MakeSlice(v.Type(), l, l).Interface()

     case reflect.Map:          n = reflect.MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
package generalise

import . "reflect"

func Allocate(i interface{}, limit... int) (n interface{}) {
     switch v := ValueOf(i); v.Kind() {
     case Slice:        l := v.Cap()
                        if len(limit) > 0 {
                               l = limit[0]
                        }
                        n = MakeSlice(v.Type(), l, l).Interface()

     case Map:           n = MakeMap(v.Type()).Interface()
     }
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func throwsPanic(f func()) (b bool) {
     defer func() {
          if x := recover(); x != nil {
                b = true
          }
     }()
     f()
     return
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func TestAllocate(t *testing.T) {
     var s2 []int

    s1 := []int{0, 1, 2}
    m := map[int] int{1: 1, 2: 2, 3: 3}
    switch {
    case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }):
          t.Fatal("Unable to allocate new slice")

    case len(s2) != 1 || cap(s2) != 1:
         t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2)

    case throwsPanic(func() { Allocate(m) }):
         t.Fatal("Unable to allocate new map")
    }
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
func Duplicate(i interface{}) (clone interface{}) {
     if clone = Allocate(i); clone != nil {
           switch clone := ValueOf(clone); clone.Kind() {
           case Slice:                Copy(clone, ValueOf(i))

          case Map:                 m := ValueOf(i)
                                    for _, k := range m.Keys() {
                                         clone.SetMapIndex(k, m.MapIndex(k))
                                    }
          }
     }
     return
}
a systems language
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
package raw

import . "reflect"
import "unsafe"

var _BYTE_SLICE Type = Typeof([]byte(nil))

type MemoryBlock interface {
    ByteSlice() []byte
}

func valueHeader(v Value) (header *SliceHeader) {
     if v.IsValid() {
            s := int(v.Type().Size())
            header = &SliceHeader{ v.UnsafeAddr(), s, s }
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) {
     switch value := Indirect(ValueOf(i)); value.Kind() {
     case Slice:         Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr()))
                         t := value.Type().Elem()
                         Size = int(t.Size())
                         Align = t.Align()
     case Interface:     Header, Size, Align = SliceHeader(value.Elem())
     }
     return
}

func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) {
     if oldHeader != nil {
           s := float64(oldESize) / float64(newESize)
           h = &SliceHeader{ Data: oldHeader.Data }
           h.Len = int(float64(oldHeader.Len) * s)
           h.Cap = int(float64(oldHeader.Cap) * s)
     }
     return
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
func ByteSlice(i interface{}) []byte {
     switch i := i.(type) {
     case []byte:                  return i
     case MemoryBlock:             return i.ByteSlice()
     }

     var header *SliceHeader
     switch v := ValueOf(i); value.Kind() {
     case Interface, Ptr:     header = valueHeader(v.Elem())

     case Slice:              h, s, _ := SliceHeader(i)
                              header = Scale(h, s, 1)

     case String:             s := v.Get()
                              h := *(*StringHeader)(unsafe.Pointer(&s))
                              header = &SliceHeader{ h.Data, h.Len, h.Len }

     default:               header = valueHeader(v)
     }
     return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte)
}
concurrent
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func() {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-c)              0110011101011010
          }
    }()
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func() {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-c)              0110011101011010
          }
    }()
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func() {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-c)              0110011101011010
          }
    }()
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func() {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-c)              0110011101011010
          }
    }()
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func() {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-c)              0110011101011010
          }
    }()
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func() {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-c)              0110011101011010
          }
    }()
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func() {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-c)              0110011101011010
          }
    }()
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
package main
import "fmt"

func main() {
     var c chan int

    c = make(chan int)
    limit := 16
    go func(in chan int) {
          for i := limit; i > 0; i-- {   produces:
                fmt.Print(<-in)             0110011101011010
          }
    }(c)
    for i := limit; i > 0; i-- {
          select {
          case c <- 0:
          case c <- 1:
          }
    }
}
func main() {
     var c chan int

    c = make(chan int, 16)
    go func() {
         for i := 16; i > 0; i-- {
               fmt.Print(<-c)
         }                           produces:
    }()
                                        0110011101011010
    go func() {
         select {
         case c <- 0:
         case c <- 1:
         }
    }()
    for {}
}
func main() {
     var c chan int

    c = make(chan int, 16)
    go func() {
         for i := 16; i > 0; i-- {
               fmt.Print(<-c)
         }                           produces:
    }()
                                        0110011101011010
    go func() {
         select {
         case c <- 0:
         case c <- 1:
         }
    }()
    for {}
}
func main() {
     var c chan int

    c = make(chan int, 16)
    go func() {
         for i := 16; i > 0; i-- {
               fmt.Print(<-c)
         }                           produces:
    }()
                                        0110011101011010
    go func() {
         select {
         case c <- 0:
         case c <- 1:
         }
    }()
    for {}
}
func main() {
     var c chan int

    c = make(chan int, 16)
    go func() {
         for i := 16; i > 0; i-- {
               fmt.Print(<-c)
         }                           produces:
    }()
                                        0110011101011010
    go func() {
         select {
         case c <- 0:
         case c <- 1:
         }
    }()
    for {}
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
package generalise

type SignalSource func(status chan bool)

func Wait(s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     <-done
}

func WaitAll(count int, s SignalSource) {
     done := make(chan bool)
     defer close(done)
     go s(done)
     for i := 0; i < count; i++ {
           <- done
     }
}
type Iteration func(k, x interface{}) bool

func (i Iteration) apply(k, v interface{}, c chan bool) {
     go func() {
           c <-i(k, v)
     }()
}

func (f Iteration) Each(c interface{}) {
     switch c := ValueOf(c); c.Kind() {
     case Slice:         WaitAll(c.Len(), SignalSource(func(done chan bool) {
                               for i := 0; i < c.Len(); i++ {
                                     f.apply(i, c.Elem(i).Interface(), done) }}))

     case Map:           WaitAll(c.Len(), SignalSource(func(done chan bool) {
                             for _, k := range c.Keys() {
                                  f.apply(k, c.Elem(k).Interface(), done) }}))
     }
}
type Iteration func(k, x interface{}) bool

func (i Iteration) apply(k, v interface{}, c chan bool) {
     go func() {
           c <-i(k, v)
     }()
}

func (f Iteration) Each(c interface{}) {
     switch c := ValueOf(c); c.Kind() {
     case Slice:         WaitAll(c.Len(), SignalSource(func(done chan bool) {
                               for i := 0; i < c.Len(); i++ {
                                     f.apply(i, c.Elem(i).Interface(), done) }}))

     case Map:           WaitAll(c.Len(), SignalSource(func(done chan bool) {
                             for _, k := range c.Keys() {
                                  f.apply(k, c.Elem(k).Interface(), done) }}))
     }
}
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers
Google Go For Ruby Hackers

More Related Content

What's hot

Pydiomatic
PydiomaticPydiomatic
Pydiomaticrik0
 
Python basic
Python basic Python basic
Python basic sewoo lee
 
Erlang bootstrap course
Erlang bootstrap courseErlang bootstrap course
Erlang bootstrap courseMartin Logan
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meetMario Fusco
 
LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기Wanbok Choi
 
Scala101, first steps with Scala
Scala101, first steps with ScalaScala101, first steps with Scala
Scala101, first steps with ScalaGiampaolo Trapasso
 
Swift internals
Swift internalsSwift internals
Swift internalsJung Kim
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
 
Learn python in 20 minutes
Learn python in 20 minutesLearn python in 20 minutes
Learn python in 20 minutesSidharth Nadhan
 
Groovy grails types, operators, objects
Groovy grails types, operators, objectsGroovy grails types, operators, objects
Groovy grails types, operators, objectsHusain Dalal
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardMario Fusco
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondMario Fusco
 
RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017Wanbok Choi
 
Coffee script
Coffee scriptCoffee script
Coffee scripttimourian
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modelingMario Fusco
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMMario Fusco
 

What's hot (20)

Pydiomatic
PydiomaticPydiomatic
Pydiomatic
 
Python basic
Python basic Python basic
Python basic
 
Erlang bootstrap course
Erlang bootstrap courseErlang bootstrap course
Erlang bootstrap course
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
 
LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기
 
Scala101, first steps with Scala
Scala101, first steps with ScalaScala101, first steps with Scala
Scala101, first steps with Scala
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Swift internals
Swift internalsSwift internals
Swift internals
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
 
Learn python in 20 minutes
Learn python in 20 minutesLearn python in 20 minutes
Learn python in 20 minutes
 
Groovy grails types, operators, objects
Groovy grails types, operators, objectsGroovy grails types, operators, objects
Groovy grails types, operators, objects
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
 
Hammurabi
HammurabiHammurabi
Hammurabi
 
RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017
 
Coffee script
Coffee scriptCoffee script
Coffee script
 
Part 7
Part 7Part 7
Part 7
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modeling
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
 
Groovy intro for OUDL
Groovy intro for OUDLGroovy intro for OUDL
Groovy intro for OUDL
 

Similar to Google Go For Ruby Hackers

Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For GoogleEleanor McHugh
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsMichael Pirnat
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my dayTor Ivry
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)Saifur Rahman
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptxGuy Komari
 
Chapter 2 Python Language Basics, IPython.pptx
Chapter 2 Python Language Basics, IPython.pptxChapter 2 Python Language Basics, IPython.pptx
Chapter 2 Python Language Basics, IPython.pptxSovannDoeur
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with PythonHan Lee
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonUC San Diego
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05cKaz Yoshikawa
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming iiPrashant Kalkar
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?Adam Dudczak
 
Stupid Awesome Python Tricks
Stupid Awesome Python TricksStupid Awesome Python Tricks
Stupid Awesome Python TricksBryan Helmig
 
Scala Functional Patterns
Scala Functional PatternsScala Functional Patterns
Scala Functional Patternsleague
 
Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016DesertJames
 

Similar to Google Go For Ruby Hackers (20)

Go a crash course
Go   a crash courseGo   a crash course
Go a crash course
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my day
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Chapter 2 Python Language Basics, IPython.pptx
Chapter 2 Python Language Basics, IPython.pptxChapter 2 Python Language Basics, IPython.pptx
Chapter 2 Python Language Basics, IPython.pptx
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
 
Hw09 Hadoop + Clojure
Hw09   Hadoop + ClojureHw09   Hadoop + Clojure
Hw09 Hadoop + Clojure
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
 
Python basic
Python basicPython basic
Python basic
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
Stupid Awesome Python Tricks
Stupid Awesome Python TricksStupid Awesome Python Tricks
Stupid Awesome Python Tricks
 
Scala Functional Patterns
Scala Functional PatternsScala Functional Patterns
Scala Functional Patterns
 
Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 

More from Eleanor McHugh

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdfEleanor McHugh
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsEleanor McHugh
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityEleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]Eleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveEleanor McHugh
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionEleanor McHugh
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]Eleanor McHugh
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with goEleanor McHugh
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxEleanor McHugh
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored SpacesEleanor McHugh
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignEleanor McHugh
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by designEleanor McHugh
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trustEleanor McHugh
 
Going Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoGoing Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoEleanor McHugh
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleEleanor McHugh
 
Go for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionGo for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionEleanor McHugh
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoEleanor McHugh
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goEleanor McHugh
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountabilityEleanor McHugh
 

More from Eleanor McHugh (20)

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient Collections
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data Integrity
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's Perspective
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd edition
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with go
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored Spaces
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By Design
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by design
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trust
 
Going Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoGoing Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google Go
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at Scale
 
Hello Go
Hello GoHello Go
Hello Go
 
Go for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionGo for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd edition
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in go
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountability
 

Recently uploaded

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

Google Go For Ruby Hackers

  • 1. Rou gh Cut ! Google Go for Ruby Hackers Eleanor McHugh http://slides.games-with-brains.net/
  • 2. Go Ruby compilation static AOT runtime mutable memory garbage collected syntax minimalist humanistic strong dynamic type embedding inheritance dispatch procedural invocation message passing semantics statements expressions
  • 4. package organisation import var, const, type declaration func, interface, map, struct, chan if ... else switch ... case ... fallthrough ... default select ... case control flow for for ... range break, continue go, goto, defer, return
  • 5. boolean, numeric, array value structure, interface reference pointer, slice, string, map, channel invocation function, method, closure
  • 6. package main import “fmt” const HELLO string = “hello” var WORLD string = “world” func main() { fmt.Println(HELLO, WORLD) }
  • 7. package main import “fmt” const HELLO string = “hello” var WORLD string = “world” func main() { fmt.Println(HELLO, WORLD) }
  • 8. package main import “fmt” const HELLO string = “hello” var WORLD string = “world” func main() { fmt.Println(HELLO, WORLD) }
  • 9. package main import “fmt” const HELLO string = “hello” var WORLD string = “world” func main() { fmt.Println(HELLO, WORLD) }
  • 11. class Counter attr_writer :count def initialize @count = 0 end def Tick @count += 1 end end class DoubleCounter < Counter def Tick super @count += 1 end end n = new(DoubleCounter) puts n.Tick puts n.superclass.Tick
  • 12. instance inherited class class expressed type
  • 13. class Counter attr_writer :count def initialize @count = 0 end def Tick @count += 1 end end class DoubleCounter < Counter def Tick super @count += 1 end end n = new(DoubleCounter) puts n.Tick puts n.superclass.Tick
  • 14. instance inherited class class expressed type
  • 15. class Counter attr_writer :count def initialize @count = 0 end def Tick @count += 1 end end class DoubleCounter < Counter def Tick super @count += 1 end end n = new(DoubleCounter) puts n.Tick puts n.superclass.Tick
  • 16. instance inherited class class expressed type
  • 17. class Counter attr_writer :count def initialize @count = 0 end def Tick @count += 1 end end class DoubleCounter < Counter def Tick super @count += 1 end end n = new(DoubleCounter) puts n.Tick puts n.superclass.Tick
  • 18. class Counter attr_writer :count def initialize @count = 0 end def Tick @count += 1 end end class DoubleCounter < Counter def Tick super @count += 1 end end n = new(DoubleCounter) puts n.Tick puts n.superclass.Tick
  • 19. class Counter attr_writer :count def initialize @count = 0 end def Tick @count += 1 end end class DoubleCounter < Counter def Tick super @count += 1 end end n = new(DoubleCounter) puts n.Tick puts n.superclass.Tick
  • 20. instance inherited class class expressed type modules
  • 21. superclass modules class modules message instance
  • 22. superclass modules class modules type asserted instance
  • 23. down a rabbit hole instances are their own classes
  • 24. down a rabbit hole instances are their own classes and all classes are mutable at runtime
  • 25. down a rabbit hole instances are their own classes all classes are mutable at runtime so inheritance pathways can be altered
  • 26. down a rabbit hole instances are their own classes and all classes are mutable at runtime so inheritance pathways can be altered making Ruby very flexible
  • 27. down a rabbit hole instances are their own classes and all classes are mutable at runtime so inheritance pathways can be altered making Ruby very flexible at the cost of type uncertainty
  • 28. down a rabbit hole instances are their own classes and all classes are mutable at runtime so inheritance pathways can be altered making Ruby very flexible at the cost of type uncertainty which really bugs computer scientists
  • 30. package Integer type Int int func (i *Int) Add(x int) { *i += Int(x) }
  • 31. memory method type layout set
  • 32. package Integer type Int int func (i *Int) Add(x int) { *i += Int(x) }
  • 33. memory method type layout set
  • 34. package Integer type Int int func (i *Int) Add(x int) { *i += Int(x) }
  • 35. memory static method layout type set
  • 36. package Integer type Int int func (i *Int) Add(x int) { *i += Int(x) }
  • 37. type Buffer []Int func (b Buffer) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b Buffer) Clone() Buffer { s := make(Buffer, len(b)) copy(s, b) return s } func (b Buffer) Move(i, n int) { if n > len(b) - i { n = len(b) - i } segment_to_move := b[:i].Clone() copy(b, b[i:i + n]) copy(b[n:i + n], segment_to_move) }
  • 38. type Buffer []Int func (b Buffer) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b Buffer) Clone() Buffer { s := make(Buffer, len(b)) copy(s, b) return s } func (b Buffer) Move(i, n int) { if n > len(b) - i { n = len(b) - i } segment_to_move := b[:i].Clone() copy(b, b[i:i + n]) copy(b[n:i + n], segment_to_move) }
  • 39. type Buffer []Int func (b Buffer) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b Buffer) Clone() Buffer { s := make(Buffer, len(b)) copy(s, b) return s } func (b Buffer) Move(i, n int) { if n > len(b) - i { n = len(b) - i } segment_to_move := b[:i].Clone() copy(b, b[i:i + n]) copy(b[n:i + n], segment_to_move) }
  • 40. package main import “fmt” import "Integer" func main() { i := Integer.Buffer{0, 1, 2, 3, 4, 5} produces: b := i.Clone() b[0:2] = [6 4] b.Swap(1, 2) b.Move(3, 2) b[0].Add(3) fmt.Printf(“b[0:2] = %vn”, b[:2]) }
  • 41. package main import “fmt” import "Integer" func main() { i := Integer.Buffer{0, 1, 2, 3, 4, 5} produces: b := i.Clone() b[0:2] = [6 4] b.Swap(1, 2) b.Move(3, 2) b[0].Add(3) fmt.Printf(“b[0:2] = %vn”, b[:2]) }
  • 42. package main import “fmt” import "Integer" func main() { i := Integer.Buffer{0, 1, 2, 3, 4, 5} produces: b := i.Clone() b[0:2] = [6 4] b.Swap(1, 2) b.Move(3, 2) b[0].Add(3) fmt.Printf(“b[0:2] = %vn”, b[:2]) }
  • 43. package main import “fmt” import "Integer" func main() { i := Integer.Buffer{0, 1, 2, 3, 4, 5} produces: b := i.Clone() b[0:2] = [6 4] b.Swap(1, 2) b.Move(3, 2) b[0].Add(3) fmt.Printf(“b[0:2] = %vn”, b[:2]) }
  • 44. package main import “fmt” import "Integer" func main() { i := Integer.Buffer{0, 1, 2, 3, 4, 5} produces: b := i.Clone() b[0:2] = [6 4] b.Swap(1, 2) b.Move(3, 2) b[0].Add(3) fmt.Printf(“b[0:2] = %vn”, b[:2]) }
  • 45. package Vector import . "Integer" type Vector struct { Buffer } func (v *Vector) Clone() *Vector { return &Vector{v.Buffer.Clone()} } func (v *Vector) Slice(i, j int) Buffer { return v.Buffer[i:j] }
  • 46. package Vector import . "Integer" type Vector struct { Buffer } func (v *Vector) Clone() *Vector { return &Vector{v.Buffer.Clone()} } func (v *Vector) Slice(i, j int) Buffer { return v.Buffer[i:j] }
  • 47. package Vector import . "Integer" type Vector struct { Buffer } func (v *Vector) Clone() *Vector { return &Vector{v.Buffer.Clone()} } func (v *Vector) Slice(i, j int) Buffer { return v.Buffer[i:j] }
  • 48. package Vector import . "Integer" type Vector struct { Buffer } func (v *Vector) Clone() *Vector { return &Vector{v.Buffer.Clone()} } func (v *Vector) Slice(i, j int) Buffer { return v.Buffer[i:j] }
  • 49. package Vector import . "Integer" type Vector struct { Buffer } func (v *Vector) Clone() *Vector { return &Vector{v.Buffer.Clone()} } func (v *Vector) Slice(i, j int) Buffer { return v.Buffer[i:j] }
  • 50. memory method layout set static type embedded types
  • 52. type Adder interface { Add(j int) Subtract(j int) Result() interface{} Reset() }
  • 53. type Adder interface { Add(j int) Subtract(j int) Result() interface{} Reset() }
  • 54. type Adder interface { Add(j int) Subtract(j int) Result() interface{} Reset() }
  • 55. type IAdder int func (i IAdder) Add(j int) { i[0] += i[j] } func (i IAdder) Subtract(j int) { i[0] -= i[j] } func (i IAdder) Result() interface{} { return i[0] } func (i IAdder) Reset() { i[0] = *new(int) } func (i IAdder) Increment() { i[0]++ }
  • 56. type IAdder int func (i IAdder) Add(j int) { i[0] += i[j] } func (i IAdder) Subtract(j int) { i[0] -= i[j] } func (i IAdder) Result() interface{} { return i[0] } func (i IAdder) Reset() { i[0] = *new(int) } func (i IAdder) Increment() { i[0]++ }
  • 57. type IAdder int func (i IAdder) Add(j int) { i[0] += i[j] } func (i IAdder) Subtract(j int) { i[0] -= i[j] } func (i IAdder) Result() interface{} { return i[0] } func (i IAdder) Reset() { i[0] = *new(int) } func (i IAdder) Increment() { i[0]++ }
  • 58. type IAdder int func (i IAdder) Add(j int) { i[0] += i[j] } func (i IAdder) Subtract(j int) { i[0] -= i[j] } func (i IAdder) Result() interface{} { return i[0] } func (i IAdder) Reset() { i[0] = *new(int) } func (i IAdder) Increment() { i[0]++ }
  • 59. type IAdder int func (i IAdder) Add(j int) { i[0] += i[j] } func (i IAdder) Subtract(j int) { i[0] -= i[j] } func (i IAdder) Result() interface{} { return i[0] } func (i IAdder) Reset() { i[0] = *new(int) } func (i IAdder) Increment() { i[0]++ }
  • 60. type FAdder []float32 func (f FAdder) Add(j int) { f[0] += f[j] } func (f FAdder) Subtract(j int) { f[0] -= f[j] } func (f FAdder) Result() interface{} { return f[0] } func (f FAdder) Reset() { f[0] = 0 }
  • 61. type FAdder []float32 func (f FAdder) Add(j int) { f[0] += f[j] } func (f FAdder) Subtract(j int) { f[0] -= f[j] } func (f FAdder) Result() interface{} { return f[0] } func (f FAdder) Reset() { f[0] = 0 }
  • 62. type FAdder []float32 func (f FAdder) Add(j int) { f[0] += f[j] } func (f FAdder) Subtract(j int) { f[0] -= f[j] } func (f FAdder) Result() interface{} { return f[0] } func (f FAdder) Reset() { f[0] = 0 }
  • 63. func TestAdder(t *testing.T) { var a Adder a = IAdder{0, 1, 2} a.Add(1) if i.Result().(int) != 1 { t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1) } a.Subtract(2) if a.Result().(int) != -1 { t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1) } a = FAdder{0.0, 1.0, 2.0} a.Add(1) if a.Result().(float32) != 1.0 { t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0) } }
  • 64. func TestAdder(t *testing.T) { var a Adder a = IAdder{0, 1, 2} a.Add(1) if i.Result().(int) != 1 { t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1) } a.Subtract(2) if a.Result().(int) != -1 { t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1) } a = FAdder{0.0, 1.0, 2.0} a.Add(1) if a.Result().(float32) != 1.0 { t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0) } }
  • 65. func TestAdder(t *testing.T) { var a Adder a = IAdder{0, 1, 2} a.Add(1) if i.Result().(int) != 1 { t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1) } a.Subtract(2) if a.Result().(int) != -1 { t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1) } a = FAdder{0.0, 1.0, 2.0} a.Add(1) if a.Result().(float32) != 1.0 { t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0) } }
  • 66. func TestAdder(t *testing.T) { var a Adder a = IAdder{0, 1, 2} a.Add(1) if i.Result().(int) != 1 { t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1) } a.Subtract(2) if a.Result().(int) != -1 { t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1) } a = FAdder{0.0, 1.0, 2.0} a.Add(1) if a.Result().(float32) != 1.0 { t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0) } }
  • 67. func TestAdder(t *testing.T) { var a Adder a = IAdder{0, 1, 2} a.Add(1) if i.Result().(int) != 1 { t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1) } a.Subtract(2) if a.Result().(int) != -1 { t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1) } a = FAdder{0.0, 1.0, 2.0} a.Add(1) if a.Result().(float32) != 1.0 { t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0) } }
  • 68. func TestAdder(t *testing.T) { var a Adder a = IAdder{0, 1, 2} a.Add(1) if i.Result().(int) != 1 { t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1) } a.Subtract(2) if a.Result().(int) != -1 { t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1) } a = FAdder{0.0, 1.0, 2.0} a.Add(1) if a.Result().(float32) != 1.0 { t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0) } }
  • 69. func TestAdder(t *testing.T) { var a Adder a = IAdder{0, 1, 2} a.Add(1) if i.Result().(int) != 1 { t.Fatalf("IAdder::Add(1) %v != %v", a.Result(), 1) } a.Subtract(2) if a.Result().(int) != -1 { t.Fatalf("IAdder::Subtract(2) %v != %v", a.Result(), -1) } a = FAdder{0.0, 1.0, 2.0} a.Add(1) if a.Result().(float32) != 1.0 { t.Fatalf("FAdder::Add(1) %v != %v", a.Result(), 1.0) } }
  • 70. down a rabbit hole an object has known static type
  • 71. down a rabbit hole an object has known static type this fixed type is determined at linking
  • 72. down a rabbit hole an object has known static type this fixed type is determined at linking no new types can be created at runtime
  • 73. down a rabbit hole an object has known static type this fixed type is determined at linking no new types can be created at runtime so dynamism is bounded to a fixed set
  • 74. down a rabbit hole an object has known static type this fixed type is determined at linking no new types can be created at runtime so dynamism is bounded to this fixed set and computer scientists are happier
  • 76. func (b Buffer) Eq(o Buffer) (r bool) { if len(b) == len(o) { for i := len(b) - 1; i > 0; i-- { if b[i] != o[i] { return } } r = true } return }
  • 77. func (b Buffer) Eq(o Buffer) (r bool) { if len(b) == len(o) { for i := len(b) - 1; i > 0; i-- { if b[i] != o[i] { return } } r = true } return }
  • 78. func (b Buffer) Eq(o Buffer) (r bool) { if len(b) == len(o) { for i := len(b) - 1; i > 0; i-- { if b[i] != o[i] { return } } r = true } return }
  • 79. func (b Buffer) Eq(o Buffer) (r bool) { if len(b) == len(o) { for i := len(b) - 1; i > 0; i-- { if b[i] != o[i] { return } } r = true } return }
  • 80. func (b Buffer) Eq(o Buffer) (r bool) { if len(b) == len(o) { for i := len(b) - 1; i > 0; i-- { if b[i] != o[i] { return } } r = true } return }
  • 81. func (b Buffer) Eq(o Buffer) (r bool) { if len(b) == len(o) { for i := len(b) - 1; i > 0; i-- { if b[i] != o[i] { return } } r = true } return }
  • 82. func (b Buffer) Eq(o Buffer) (r bool) { if len(b) == len(o) { for i := len(b) - 1; i > 0; i-- { if b[i] != o[i] { return } } r = true } return }
  • 83. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 84. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 85. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 86. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 87. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 88. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 89. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 90. package Vector import "testing" func TestVectorSwap(t *testing.T) { i := Vector{Buffer{0, 1, 2, 3, 4, 5}} v := i.Clone() v.Swap(1, 2) r := Vector{Buffer{0, 2, 1, 3, 4, 5}} switch { case !v.Eq(r.Buffer): fallthrough case !v.Buffer.Eq(r.Buffer): t.Fatalf("b[0:5] = %v", v) } }
  • 91. include $(GOROOT)/src/Make.inc TARG=integer GOFILES= integer.go vector.go include $(GOROOT)/src/Make.pkg
  • 92. package Vector import "testing" import "vector" func BenchmarkVectorClone6(b *testing.B) { v := Vector{Buffer{0, 1, 2, 3, 4, 5}} for i := 0; i < b.N; i++ { _ = v.Clone() } } func BenchmarkVectorSwap(b *testing.B) { b.StopTimer() v := Vector{Buffer{0, 1, 2, 3, 4, 5}} b.StartTimer() for i := 0; i < b.N; i++ { v.Swap(1, 2) } }
  • 93. package Vector import "testing" import "vector" func BenchmarkVectorClone6(b *testing.B) { v := Vector{Buffer{0, 1, 2, 3, 4, 5}} for i := 0; i < b.N; i++ { _ = v.Clone() } } func BenchmarkVectorSwap(b *testing.B) { b.StopTimer() v := Vector{Buffer{0, 1, 2, 3, 4, 5}} b.StartTimer() for i := 0; i < b.N; i++ { v.Swap(1, 2) } }
  • 94. package Vector import "testing" import "vector" func BenchmarkVectorClone6(b *testing.B) { v := Vector{Buffer{0, 1, 2, 3, 4, 5}} for i := 0; i < b.N; i++ { _ = v.Clone() } } func BenchmarkVectorSwap(b *testing.B) { b.StopTimer() v := Vector{Buffer{0, 1, 2, 3, 4, 5}} b.StartTimer() for i := 0; i < b.N; i++ { v.Swap(1, 2) } }
  • 95. package Vector import "testing" import "vector" func BenchmarkVectorClone6(b *testing.B) { v := Vector{Buffer{0, 1, 2, 3, 4, 5}} for i := 0; i < b.N; i++ { _ = v.Clone() } } func BenchmarkVectorSwap(b *testing.B) { b.StopTimer() v := Vector{Buffer{0, 1, 2, 3, 4, 5}} b.StartTimer() for i := 0; i < b.N; i++ { v.Swap(1, 2) } }
  • 96. package Vector import "testing" import "vector" func BenchmarkVectorClone6(b *testing.B) { v := Vector{Buffer{0, 1, 2, 3, 4, 5}} for i := 0; i < b.N; i++ { _ = v.Clone() } } func BenchmarkVectorSwap(b *testing.B) { b.StopTimer() v := Vector{Buffer{0, 1, 2, 3, 4, 5}} b.StartTimer() for i := 0; i < b.N; i++ { v.Swap(1, 2) } }
  • 97. package Vector import "testing" import "vector" func BenchmarkVectorClone6(b *testing.B) { v := Vector{Buffer{0, 1, 2, 3, 4, 5}} for i := 0; i < b.N; i++ { _ = v.Clone() } } func BenchmarkVectorSwap(b *testing.B) { b.StopTimer() v := Vector{Buffer{0, 1, 2, 3, 4, 5}} b.StartTimer() for i := 0; i < b.N; i++ { v.Swap(1, 2) } }
  • 98. $ gotest -bench="Benchmark" rm -f _test/scripts.a 6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go embedded_typing_benchmark_test.go embedded_typing_test.go rm -f _test/scripts.a gopack grc _test/scripts.a _gotest_.6 PASS integer.BenchmarkVectorSwap 200000000 8 ns/op integer.BenchmarkVectorClone6 10000000 300 ns/op
  • 99. $ gotest -bench="Benchmark" rm -f _test/scripts.a 6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go embedded_typing_benchmark_test.go embedded_typing_test.go rm -f _test/scripts.a gopack grc _test/scripts.a _gotest_.6 PASS integer.BenchmarkVectorSwap 200000000 8 ns/op integer.BenchmarkVectorClone6 10000000 300 ns/op
  • 100. $ gotest -bench="Benchmark" rm -f _test/scripts.a 6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go embedded_typing_benchmark_test.go embedded_typing_test.go rm -f _test/scripts.a gopack grc _test/scripts.a _gotest_.6 PASS integer.BenchmarkVectorSwap 200000000 8 ns/op integer.BenchmarkVectorClone6 10000000 300 ns/op
  • 101. $ gotest -bench="Benchmark" rm -f _test/scripts.a 6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go embedded_typing_benchmark_test.go embedded_typing_test.go rm -f _test/scripts.a gopack grc _test/scripts.a _gotest_.6 PASS integer.BenchmarkVectorSwap 200000000 8 ns/op integer.BenchmarkVectorClone6 10000000 300 ns/op
  • 102. $ gotest -bench="Benchmark" rm -f _test/scripts.a 6g -o _gotest_.6 integer.go vector.go nominal_typing_test.go embedded_typing_benchmark_test.go embedded_typing_test.go rm -f _test/scripts.a gopack grc _test/scripts.a _gotest_.6 PASS integer.BenchmarkVectorSwap 200000000 8 ns/op integer.BenchmarkVectorClone6 10000000 300 ns/op
  • 104. package generalise import "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := reflect.ValueOf(i); v.Kind() { case reflect.Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = reflect.MakeSlice(v.Type(), l, l).Interface() case reflect.Map: n = reflect.MakeMap(v.Type()).Interface() } return }
  • 105. package generalise import "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := reflect.ValueOf(i); v.Kind() { case reflect.Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = reflect.MakeSlice(v.Type(), l, l).Interface() case reflect.Map: n = reflect.MakeMap(v.Type()).Interface() } return }
  • 106. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 107. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 108. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 109. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 110. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 111. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 112. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 113. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 114. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 115. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 116. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 117. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 118. package generalise import . "reflect" func Allocate(i interface{}, limit... int) (n interface{}) { switch v := ValueOf(i); v.Kind() { case Slice: l := v.Cap() if len(limit) > 0 { l = limit[0] } n = MakeSlice(v.Type(), l, l).Interface() case Map: n = MakeMap(v.Type()).Interface() } return }
  • 119. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 120. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 121. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 122. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 123. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 124. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 125. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 126. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 127. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 128. func throwsPanic(f func()) (b bool) { defer func() { if x := recover(); x != nil { b = true } }() f() return }
  • 129. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 130. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 131. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 132. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 133. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 134. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 135. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 136. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 137. func TestAllocate(t *testing.T) { var s2 []int s1 := []int{0, 1, 2} m := map[int] int{1: 1, 2: 2, 3: 3} switch { case throwsPanic(func() { s2 = Allocate(s1, 1).([]int) }): t.Fatal("Unable to allocate new slice") case len(s2) != 1 || cap(s2) != 1: t.Fatalf("New slice should be %v not %v", make([]int, 0, 1), s2) case throwsPanic(func() { Allocate(m) }): t.Fatal("Unable to allocate new map") } }
  • 138. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 139. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 140. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 141. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 142. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 143. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 144. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 145. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 146. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 147. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 148. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 149. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 150. func Duplicate(i interface{}) (clone interface{}) { if clone = Allocate(i); clone != nil { switch clone := ValueOf(clone); clone.Kind() { case Slice: Copy(clone, ValueOf(i)) case Map: m := ValueOf(i) for _, k := range m.Keys() { clone.SetMapIndex(k, m.MapIndex(k)) } } } return }
  • 152. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 153. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 154. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 155. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 156. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 157. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 158. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 159. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 160. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 161. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 162. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 163. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 164. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 165. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 166. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 167. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 168. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 169. package raw import . "reflect" import "unsafe" var _BYTE_SLICE Type = Typeof([]byte(nil)) type MemoryBlock interface { ByteSlice() []byte } func valueHeader(v Value) (header *SliceHeader) { if v.IsValid() { s := int(v.Type().Size()) header = &SliceHeader{ v.UnsafeAddr(), s, s } } return }
  • 170. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 171. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 172. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 173. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 174. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 175. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 176. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 177. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 178. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 179. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 180. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 181. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 182. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 183. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 184. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 185. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 186. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 187. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 188. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 189. func SliceHeader(i interface{}) (Header *SliceHeader, Size, Align int) { switch value := Indirect(ValueOf(i)); value.Kind() { case Slice: Header = (*SliceHeader)(unsafe.Pointer(value.UnsafeAddr())) t := value.Type().Elem() Size = int(t.Size()) Align = t.Align() case Interface: Header, Size, Align = SliceHeader(value.Elem()) } return } func Scale(oldHeader *SliceHeader, oldESize, newESize int) (h *SliceHeader) { if oldHeader != nil { s := float64(oldESize) / float64(newESize) h = &SliceHeader{ Data: oldHeader.Data } h.Len = int(float64(oldHeader.Len) * s) h.Cap = int(float64(oldHeader.Cap) * s) } return }
  • 190. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 191. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 192. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 193. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 194. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 195. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 196. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 197. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 198. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 199. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 200. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 201. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 202. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 203. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 204. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 205. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 206. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 207. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 208. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 209. func ByteSlice(i interface{}) []byte { switch i := i.(type) { case []byte: return i case MemoryBlock: return i.ByteSlice() } var header *SliceHeader switch v := ValueOf(i); value.Kind() { case Interface, Ptr: header = valueHeader(v.Elem()) case Slice: h, s, _ := SliceHeader(i) header = Scale(h, s, 1) case String: s := v.Get() h := *(*StringHeader)(unsafe.Pointer(&s)) header = &SliceHeader{ h.Data, h.Len, h.Len } default: header = valueHeader(v) } return unsafe.Unreflect(_BYTE_SLICE, unsafe.Pointer(header)).([]byte) }
  • 211. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func() { for i := limit; i > 0; i-- { produces: fmt.Print(<-c) 0110011101011010 } }() for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 212. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func() { for i := limit; i > 0; i-- { produces: fmt.Print(<-c) 0110011101011010 } }() for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 213. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func() { for i := limit; i > 0; i-- { produces: fmt.Print(<-c) 0110011101011010 } }() for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 214. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func() { for i := limit; i > 0; i-- { produces: fmt.Print(<-c) 0110011101011010 } }() for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 215. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func() { for i := limit; i > 0; i-- { produces: fmt.Print(<-c) 0110011101011010 } }() for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 216. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func() { for i := limit; i > 0; i-- { produces: fmt.Print(<-c) 0110011101011010 } }() for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 217. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func() { for i := limit; i > 0; i-- { produces: fmt.Print(<-c) 0110011101011010 } }() for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 218. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 219. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 220. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 221. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 222. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 223. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 224. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 225. package main import "fmt" func main() { var c chan int c = make(chan int) limit := 16 go func(in chan int) { for i := limit; i > 0; i-- { produces: fmt.Print(<-in) 0110011101011010 } }(c) for i := limit; i > 0; i-- { select { case c <- 0: case c <- 1: } } }
  • 226. func main() { var c chan int c = make(chan int, 16) go func() { for i := 16; i > 0; i-- { fmt.Print(<-c) } produces: }() 0110011101011010 go func() { select { case c <- 0: case c <- 1: } }() for {} }
  • 227. func main() { var c chan int c = make(chan int, 16) go func() { for i := 16; i > 0; i-- { fmt.Print(<-c) } produces: }() 0110011101011010 go func() { select { case c <- 0: case c <- 1: } }() for {} }
  • 228. func main() { var c chan int c = make(chan int, 16) go func() { for i := 16; i > 0; i-- { fmt.Print(<-c) } produces: }() 0110011101011010 go func() { select { case c <- 0: case c <- 1: } }() for {} }
  • 229. func main() { var c chan int c = make(chan int, 16) go func() { for i := 16; i > 0; i-- { fmt.Print(<-c) } produces: }() 0110011101011010 go func() { select { case c <- 0: case c <- 1: } }() for {} }
  • 230. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 231. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 232. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 233. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 234. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 235. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 236. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 237. package generalise type SignalSource func(status chan bool) func Wait(s SignalSource) { done := make(chan bool) defer close(done) go s(done) <-done } func WaitAll(count int, s SignalSource) { done := make(chan bool) defer close(done) go s(done) for i := 0; i < count; i++ { <- done } }
  • 238. type Iteration func(k, x interface{}) bool func (i Iteration) apply(k, v interface{}, c chan bool) { go func() { c <-i(k, v) }() } func (f Iteration) Each(c interface{}) { switch c := ValueOf(c); c.Kind() { case Slice: WaitAll(c.Len(), SignalSource(func(done chan bool) { for i := 0; i < c.Len(); i++ { f.apply(i, c.Elem(i).Interface(), done) }})) case Map: WaitAll(c.Len(), SignalSource(func(done chan bool) { for _, k := range c.Keys() { f.apply(k, c.Elem(k).Interface(), done) }})) } }
  • 239. type Iteration func(k, x interface{}) bool func (i Iteration) apply(k, v interface{}, c chan bool) { go func() { c <-i(k, v) }() } func (f Iteration) Each(c interface{}) { switch c := ValueOf(c); c.Kind() { case Slice: WaitAll(c.Len(), SignalSource(func(done chan bool) { for i := 0; i < c.Len(); i++ { f.apply(i, c.Elem(i).Interface(), done) }})) case Map: WaitAll(c.Len(), SignalSource(func(done chan bool) { for _, k := range c.Keys() { f.apply(k, c.Elem(k).Interface(), done) }})) } }

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. \n
  154. \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n
  164. \n
  165. \n
  166. \n
  167. \n
  168. \n
  169. \n
  170. \n
  171. \n
  172. \n
  173. \n
  174. \n
  175. \n
  176. \n
  177. \n
  178. \n
  179. \n
  180. \n
  181. \n
  182. \n
  183. \n
  184. \n
  185. \n
  186. \n
  187. \n
  188. \n
  189. \n
  190. \n
  191. \n
  192. \n
  193. \n
  194. \n
  195. \n
  196. \n
  197. \n
  198. \n
  199. \n
  200. \n
  201. \n
  202. \n
  203. \n
  204. \n
  205. \n
  206. \n
  207. \n
  208. \n
  209. \n
  210. \n
  211. \n
  212. \n
  213. \n
  214. \n
  215. \n
  216. \n
  217. \n
  218. \n
  219. \n
  220. \n
  221. \n
  222. \n
  223. \n
  224. \n
  225. \n
  226. \n
  227. \n
  228. \n
  229. \n
  230. \n
  231. \n
  232. \n
  233. \n
  234. \n
  235. \n
  236. \n
  237. \n
  238. \n
  239. \n
  240. \n
  241. \n
  242. \n
  243. \n
  244. \n
  245. \n
  246. \n
  247. \n
  248. \n
  249. \n
  250. \n
  251. \n
  252. \n
  253. \n
  254. \n
  255. \n
  256. \n
  257. \n
  258. \n
  259. \n
  260. \n
  261. \n
  262. \n
  263. \n
  264. \n
  265. \n
  266. \n
  267. \n
  268. \n
  269. \n
  270. \n
  271. \n
  272. \n
  273. \n
  274. \n
  275. \n
  276. \n
  277. \n
  278. \n
  279. \n
  280. \n
  281. \n
  282. \n
  283. \n
  284. \n
  285. \n
  286. \n
  287. \n
  288. \n
  289. \n
  290. \n
  291. \n
  292. \n
  293. \n
  294. \n
  295. \n
  296. \n
  297. \n
  298. \n
  299. \n
  300. \n
  301. \n
  302. \n
  303. \n
  304. \n
  305. \n
  306. \n
  307. \n
  308. \n
  309. \n
  310. \n
  311. \n
  312. \n
  313. \n
  314. \n
  315. \n
  316. \n
  317. \n
  318. \n
  319. \n
  320. \n
  321. \n
  322. \n
  323. \n
  324. \n
  325. \n
  326. \n
  327. \n
  328. \n
  329. \n
  330. \n
  331. \n
  332. \n
  333. \n
  334. \n
  335. \n
  336. \n
  337. \n
  338. \n
  339. \n
  340. \n
  341. \n
  342. \n
  343. \n
  344. \n
  345. \n
  346. \n
  347. \n
  348. \n
  349. \n
  350. \n
  351. \n
  352. \n