hoodwink.d enhanced


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

Into this code:

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

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

said on 13 Nov 2006 at 16:27

Oh wow. Stealing the visitor patern from java and using it to make Smalltalk. What will the world come to next?

said on 13 Nov 2006 at 17:31

An end.

said on 13 Nov 2006 at 22:46

_lynX: hopefully it started with a

loop do

said on 13 Nov 2006 at 23:12

He has a great point about the speed of the StrongTalk VM though. From what I’ve read, it flies. I downloaded the source, eager to have a play, before discovering it’s all Windows-fied.. eugh. Perhaps when someone with more knowledge than me gets it running on a proper operating system it’ll be an exciting VM to target? Pushing it through JRuby doesn’t seem like a real solution.

said on 14 Nov 2006 at 05:11

can’t wait to see ruccola in action for comparison!

said on 14 Nov 2006 at 15:10

bishop, you’re awesome!

said on 18 Nov 2006 at 14:34

FlashHater: visitor pattern stolen from… java?

said on 18 Nov 2006 at 14:36

_why: so, while hanging out with Avi at OOPSLA we talked about this and I got cracking on ruby2smalltalk.rb using ParseTree. I’ve got 60 failing testcases to go (you can inherit the tests from ParseTree and ensure full coverage) but it is already turing complete and translating runnable things like fib to smalltalk…

I’ll be doing a public release soon.

11 Jul 2010 at 20:56

* do fancy stuff in your comment.