Smalltalk in Lively
This world demonstrates how Smalltalk code can be evaluated in Lively by compiling it to JavaScript code which is then executed. To try it out select expressions to the right and press CMD+d for evaluating or Cmd+p for printing those Smalltalk expressions. The smaller workspace at the bottom will show the compiled JS code. If you want to know how this is implemented see the OMeta grammar that is used for translating Smalltalk expressions into AST nodes and the very simple ST-JS printer.

load now
is loaded
Smalltalk workspace

"simple code"
1 + 2.
"simple collection stuff"
#{1. 2. 3. 4. 5.} collect: [:i | i * 2].
"making the world a bit brighter..."
world := ((lively at: 'morphic') at: 'World') current.
world setFill: (Color r: 255 g: 0 b: 0).
"Ascii art with a block"
f := [:x :y | (x + '=' times: y) + x ].
f value: '-' value: 25.
"How warm is it in Palo Alto? (Featuring a block as well, for showing off...)"
extractTemp := [:json | | getter temp |
getter := Global path: ''.
temp := getter get: json.
world inform: ('In ' + loc + ' are ' + temp + ' Fahrenheit').].
loc := 'Palo Alto, CA'.
url := Strings for: ''
m: 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="' + loc + '")'
a: 'json'
t: 'store://'.
(WebResource create: (Global encodeURI: url)) beAsync get withJSONWhenDone: extractTemp.
"make the morphs go round!"
world getSubmorphs forEach: [:morph |
at: 'velocity' put: (Global p: 20 t: 20) random;
at: 'angularVelocity' put: 0.1 * Math random;
start: 100 Stepping: 'stepAndBounce'].

Compiled JS code