class Counter
  {
    value : int = 1;
    method set : int -> Counter;
  }
  {
    set (n : int) = { this.value = n; this; };
  }

def writeln (x) = { write(x); write("\n"); };

let c; in { c = new Counter; c.set(c.value+2); writeln(c.value);};
 
class Foo { bar : Bar; }
class Bar { foo : Foo; }
class Baz { foo : Foo; bar : Bar; }

let f = new Foo;
    b = new Bar;
    x = new Baz;
in  {
      f.bar = b;
      b.foo = f;
      x.foo = f;
      x.bar = b;
      x;
    };

class Test { foo : int -> real; }

def f(x:int) = x+3.15;

edef test = new Test;

test.foo(1);

test.foo = f;

test.foo(1);
