Skip to content

Porting code from other Smalltalk dialects

gokr edited this page Aug 30, 2011 · 16 revisions

Jtalk is different than regular Smalltalk in a few ways which makes porting code a non-trivial thing, but also quite manageable. Things you need to fix in MyCategory.st before it works:

  • Rewrite character literals as Strings and make changes accordingly. Jtalk does not have Character.
  • Rewrite uses of "==" and other mechanisms associated with the concept of object identity. Jtalk does not support identity!
  • Rewrite uses of class variables. Jtalk does support class instance variables, but not class variables.
  • Remove any pragmas. We will add support in the parser to just ignore them.

The current way to get code into Jtalk from another Smalltalk goes like this:

  1. After fixing the above things in your "other Smalltalk", export the code as a "fileout" in the chunk format with a .st filename extension. Make one file per class category and give it the same name as the class category - otherwise it breaks.
  2. Monticello style class extensions (loose methods) using "*yaddayadda" method category names is allowed.
  3. Run "jtalkc MyCategory.st" to compile it into MyCategory.js. Put this file into the $JTALK/js directory.
  4. Load http://localhost/jtalk/ide.html (or whatever path you use) and you should have the code in Jtalk.

After this, pressing commit should store any changes made (of selected class category) back to localhost using WebDAV, if you have set it up properly. It also stores a corresponding MyCategory.st-file in the st directory and a special MyCategory.deploy.js file which is a stripped down version for deployment purposes.

Clone this wiki locally