potion  0.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
potion
See also
doc/INTERNALS.md

Everything is an object. Every object is a closure (lambda), even values, variables, classes, types, metaclasses, ... It's essentially a LISP-1.

PN is either an immediate tagged value for int, bool and nil, or a ptr to an object.

ops use a three-addresss layout: "dest = op src what" in a single word

The root class is P->lobby, which holds global values and methods.

Methods use as first three params:

  • Potion *P - the global interpeter singleton (not threaded yet)
  • PN cl - bound closure, the optional parent enclosing block for the lexical environment. This gives shared methods access to any differentiating data that might be stored in the closure.
  • PN self - the object we are acting on

and optionally args, statically typed via signature strings.

Potion method signatures:

name=one-char type.

  • o PN (any)
  • N Num
  • & Closure
  • S String