[Grace-core] Fwd: INCOMPLETE: gradual typing + structural typing + typecase
James Noble
kjx at ecs.vuw.ac.nz
Tue Jul 2 08:25:15 PDT 2013
On 2/07/2013, at 17:17 PM, Kim Bruce <kim at cs.pomona.edu> wrote:
> We couldn't understand your example. Can you explain it?
I tried recoding in Grace - this always returns 1 for me.
type A = {
a(_ : A) -> Done
}
type B = {
b(_ : B) -> Done
}
def x = object {
var f is readable, writable, public := object {
method a(x) {x}
method b(y) {y}
}
method get {f}
method set(g) { f := g }
}
// then x has type { get : {} -> A, set : A -> {} }
match (x.f)
case { b : B -> print "1" }
case { _ -> print "2" }
More information about the Grace-core
mailing list