Robert Fisher

Just thinking out loud

Self notes

If you register and log in you can add comments to my pages. If viewing the main blog page, click the # underneath an entry to comment on it.

A literal object consists of a list of slots & a list of expressions with some parentheses & verticle bars.

(| slot1. slotn | expr1. exprn )
  • No initializer means: slot <- nil
  • Slot's set with = are read-only.
    • Sending the object a slotName message will get the slot's value.
  • Slot's set with <- are read/write.
    • Sending the object a slotName message will get the slot's value.
    • Sending the object a slotName: message will set the slot's value.
  • If the slot's name ends with an asterisk, it is a parent slot. (The asterisk isn't used in the slot's messages.)
  • Methods are read-only slots containing objects with code.
  • Square brackets are used in place of parentheses to create blocks/closures.

e.g.

(| readOnlySlot = 10. writableSlot <- 20. |)
(| readOnlyParent* = x. writableParent* <- y |)
(| square = (| :arg | arg * arg ) |)
[| :arg | arg * arg ]
  • (...unary, binary, & keyword messages...)

  • Methods are read-only! (EcmaScript makes them read/write?)
  • Slot look-up is depth first?
  • Slot look-up handles cyclic inheritence graphs!