hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Monday

2006.11.13

Visitors Who Steal Ruby Off to New VMs #

by why in inspect

Avi: So I wrote a visitor that does the least work possible to translate the simplest Ruby program possible into something Squeak Smalltalk can load and run, and hey, it adds 3+4 and comes up with 7.

He’s talking about his smalltalk.rb, which translates this code:

 class HelloRuby
   def zot
     3+4
   end
 end

Into this code:

 Object subclass: #HelloRuby instanceVariableNames: '' 
   classVariableNames: '' poolDictionaries: '' category: 'Ruby'!
 !HelloRuby methodsFor: 'ruby' stamp: ''!
 zot
 ^ 3 + 4

Neat. You know, I think NodeVisitor would be a really great tankshed RCR.