name n: Structural { .name = Str } = n.name

C = Class { .name = Str }
C.
    new name = C::__new__ { .name = name }
D = Class { .name = Str; .id = Nat }
D.
    new name, id = D::__new__ { .name = name; .id = id }

c = C.new "foo"
d = D.new "bar", 1

assert name(c) == "foo"
assert name(d) == "bar"

inner|T| x: Structural { .inner = T } = x.inner

E = Class { .inner = Int }
E.
    new inner = E::__new__ { .inner = inner }
    __add__ self, other: E = E::__new__ { .inner = self.inner + other.inner }

e = E.new 1

assert inner(e) == 1

add|T, U, V| x: Structural({ .__add__ = (self: T, other: U) -> V }), other: U =
    x.__add__(other)

_ = add 1, 2
_ = add e, e
