kyleect / locks

A toy language branched from Lox to learn language implementation and tooling. Forked from loxcraft
https://kyleect.github.io/locks/#/docs
MIT License
0 stars 0 forks source link

Class constructor/init method should not be an instance method #81

Open kyleect opened 7 months ago

kyleect commented 7 months ago
class Foo {
  fn init(arg) {
    print "Foo.init(" + arg + ")";
    this.field = "init";
  }
}

let foo = Foo("one"); // out: Foo.init(one)
foo.field = "field";

let foo2 = foo.init("two"); // out: Error: No method "init" on instance