Oi the language

This page documents how Oi will change next. Exciting! 😻

Mutation

This is the largest missing fundamental piece. Oi is, at its heart, an old-fashioned language and wants to mutate things. This means setting slots on objects. Concretely, the setSlot method on initial needs to be implemented.

Errors

Oi doesn't help much with errors right now. 🙁 It'd be great to get descriptive errors, at least for simple cases like mistyped method names.

Usability

For Oi to be usable in any real sense, we need a standard library! For an example, right now, lists have no methods at all! Not even a map method. 😱

It'd be best if we could implement as much as possible of the standard library in Oi itself. Some way to load Oi code is needed, then. On that note, there's no way to run an Oi file yet either!

More detailed specification work

The following is initial thinking and understanding on how Oi works. The more general sections above should be expanded here.

  1. The anatomy of a method call
  2. Evaluation
  3. Primitives

The anatomy of a method call

At runtime, we have a call object like:

For an example, here's how it plays out when we call the list method on the implicit lobby object when we're at the top in the REPL (imagining we have a REPL for a moment):

Note that to avoid circularity we used varargs to give the arguments to message instead of a single list.

Next, Oi finds the "list" slot on lobby and activates it. In the case of list, the slot is a native function, so Oi just calls that function directly.

Evaluation

When evaluating code, the Oi interpreter works on objects. Every item being interpreted is an object. In this sense, interpretation Oi is straightforward. The important question is what happens when we have a method call. When do we perform the call? What if the call is in argument position?

Oi currently performs method calls in argument position before passing them into the method. This will change so that every method can choose: if a method body doesn't mention an argument directly, calls in that argument are not performed unless the method body asks for them to be performed via the arguments object available to the method body. Concretely, this enables us to write control structures as regular functions:

Primitives

Not written yet. 😑