v0.16.0

Method Calls

Ghost is under heavy active development

While we strive to keep our documentation up to date, it's possible that it may fall out of sync with the latest developments on GitHub.

Ghost is deeply object oriented, so most code consists of invoking methods on objects, usually something like this:

dog.speak("Throw the ball!");

You have a receiver expression (here dog) followed by a ., then a name (speak) and an argument list in parentheses (("Throw the ball!")). Multiple arguments are separated by commas:

dog.command("fetch", "ball");

The argument list can also be empty:

dog.sit();

Ghost executes a method call like so:

  1. Evaluate the receiver and arguments from left to right.
  2. Look up the method on the receiver's object.
  3. Invoke it, passing in the argument values.