キーワード引数風
実はこれ、JavaScriptでもできる。
function Fish(speed, direction, x, y) { this.speed = speed; ... } var fish = new Fish(speed = 10, direction = 1, x = 10, y = 100);
いや、これキーワード引数じゃなくて単にコンストラクタの引数に代入式が入っているだけだし。要するに以下と一緒。
speed = 10, direction = 1, x = 10, y = 10; var fish = new Fish(speed, direction, x, y);