hoodwink.d enhanced


The Soda Languages #

by why in cult

Whoa, get ready to spend your whole afternoon tooling around with a small pile of little languages and compilers. I am completely hooked on Idst, a compiler for a hybrid prototype-based Smalltalk-plus-C language by Ian Piumarta. And atop the bedrock of Idst: the soda languages.

I first heard about Ian’s stuff in a #camping discussion where Pepsi (the Smalltalk/C hybrid) was brought up. Well, it turns out Idst also comes with a Lisp-like soda language called Jolt (see examples/jolt.) Other examples are just great and include a teensy Squeak VM (examples/sqvm) and some X11 samples (examples/x11.)

He explains the Pepsi syntax in an interview a few days ago on the Weekly Squeak:

You can mix C-code and “Id” code in a very simple way. So it is easy to integrate with O.S. services. The idea is quite the opposite of Objective-C: you think in terms of objects all the time (as in SmallTalk). Then you “come back” to C-Language for the dirty part of your work.

The syntax is suprisingly terse. You use curly braces to break out into a method written in C. Square brackets for Smalltalk-style.

 X11Display newWindow  [ ^X11Window withDisplay: self ]

 X11Display _createSimpleWindow_: _x _: _y _: _w _: _h _: _bw _: _b _: _bg
   return (oop)XCreateSimpleWindow((Display *)self->v__dpy,
     DefaultRootWindow((Display *)self->v__dpy),
     (int)v__x, (int)v__y, (int)v__w, (int)v__h,
     (int)v__bw, (int)v__b, (int)v__bg);

 X11Display createWindow: bounds borderWidth: borderWidth 
   border: border background: background
   ^self newWindow
  _win_: (self _createSimpleWindow_: (bounds _x) _: (bounds _y) 
   _: (bounds _w) _: (bounds _h)
   _: borderWidth _integerValue
   _: border _integerValue
   _: background _integerValue)

Can you get over that?

Update: Some of the above interview appears to be taken from a post on the Smalltalk newsgroup, which goes into greater detail concerning Coke and Jolt, as well as the other literal man-decades of work Ian has assigned himself.

It’s often said that Smalltalk and Lisp suffer because they are systems that eat all of their young. If COLA succeeds it might be called the system that ate its parents.

said on 19 Oct 2006 at 13:45

I guess so, but what’s the deal with the funky variable names?

said on 19 Oct 2006 at 13:49

Where’s info on Id itself? (sadly, in these dark ages, we still search by undifferentiated symbol, of which “Id” is a rather common example)

said on 19 Oct 2006 at 14:23

Literally, that open directory is it. But, if you unpack the distro and look around, there’s a bunch of 00_README files around and INSTALL works like it says.

said on 19 Oct 2006 at 14:29

, redFaced, ‘ta’

said on 19 Oct 2006 at 16:30

isn’t this kind of like using RubyInline?

said on 19 Oct 2006 at 17:08

The Haskell FFI is one of the most sensible I’ve seen (Ruby’s is quite nice, though).

Unfortunately, it’s only documented as a Report.

But you can basically declare, from within Haskell code, that a given Haskell function is actually a C function underneath:

foreign import ccall “getpid” getpid :: IO Int

and then use it like any other function you would in normal code:

my_pid <- getpid
print my_pid
(PS: your markup is hella annoying for including code—after playing with it a bit I still couldn’t get this to format right in the preview.)

said on 20 Oct 2006 at 02:11

There goes another “whole afternoon”...

Thanks for “cettes pointers invaluables”. The blogosphere isn’t exactly bristling with information on programming language exotica.

(And, know that people out here are keen on Syck for Io. Go, go!)

said on 20 Oct 2006 at 09:49

You might have missed this which explains the concepts in much more detail: http://piumarta.com/papers/colas-whitepaper.pdf

...and yes, I have been hooked for a few weeks. This sure can get really exciting if all turns out as planned.

said on 20 Oct 2006 at 11:21

No, no, no more timesinks.

11 Jul 2010 at 21:03

* do fancy stuff in your comment.