Avarel / Kaiper

Functional scripting in Java.
Apache License 2.0
10 stars 0 forks source link

Draft for reference invocation and using #10

Closed Avarel closed 6 years ago

Avarel commented 6 years ago
let complex0 = re: 2, im: 3
let complex1 = re: 3, im: 5

module Complex {
    def (re, im)::plus(re, im) = re: this.re + re, im: this.im + im
    def (re, im)::minus(re, im) = re: this.re - re, im: this.im - im
}

// without using the module (plain importing)
complex0::Complex.plus(complex1)

// using the module
using Complex
complex0::plus(complex1)

Design

module Complex {
  type t(re, im)
}
Avarel commented 6 years ago

Will be revisited another time.