Website | Source

EVERYTHING IS AN OBJECT. However, OBJECTS AREN'T EVERYTHING.

(And, incidentally, everything is a function.)

Its exciting points are:

However, some warnings:

~ a whiff of potion ~

5 times: "Odelay!" print.

Or,

add = (x, y): x + y.
add(2, 4) string print

Or,

hello =
  "(x): ('hello ', x) print." eval
hello ('world')

~ items to understand ~

  1. A traditional object is a tuple of data and methods: (D, M). D is kept in the object itself. M is kept in classes.

  2. In Potion, objects are just D.

  3. Every object has an M.

  4. But M can be altered, swapped, added to, removed from, whatever.

  5. Objects do not have classes. The M is a mixin, a collection of methods.

Example: all strings have a "length" method. This method comes with Potion. It's in the String mixin.

  1. You can swap out mixins for the span of a single source file.

Example: you could give all strings a "backwards" method. But just for the code inside your test.pn script.

  1. You can re-mix for the span of a single closure.

To sum up:

EVERYTHING IS AN OBJECT. EVEN MIXINS ARE OBJECTS. AND, OF COURSE, CLOSURES ARE OBJECTS.

However, OBJECTS AREN'T EVERYTHING. THEY ARE USELESS WITHOUT MIXINS.

~ unique ideas (to be implemented) ~

Potion does have a few unique features underway.


Tags: language   vm  

Last modified 22 November 2023