Dynamic messages: a tour of Pepsi

16 October, 2006

Ian Piumarta is already known for the efforts on the Unix port of Squeak.
The last Ian work is Pepsi, a dynamic-compiled language which is promising very well.

Weekly Squeak has just done some questions to him, and a deep analysis ofPepsi.

Giorgi:What are exactly Id and Pepsi?

Piumarta: ‘Id‘ is an object model. It’s the simplest possible model that
permits an object to receive a message without introducing any early bound assumptions in the mechanisms.
Pepsi‘ is a generic name for the universe of simple object models and
languages that can be built directly on top of Id.
These exist mainly to provide a message-oriented foundation for making object structures in.

Idst‘ is a Smalltalk-like syntax (and object library) built on Id using
prototypes rather than [meta]classes. The runtime is entirely
dynamic but the code compiles to a static (native) executable.

And now the code!

I have downloaded the code found in http://piumarta.com/pepsi/

The source pack has a lot of example.
With Pepsi, Ian rewrote a pice of Smalltalk library using a prototype-based approach (like Self or IoLanguage).

There are a lot of concepts, and this article is not going to explore them all.

These are the major point in my own opinion:

  1. Id provide a compiled executable with dynamic message sending and a Garbage Collector.
    Id is based on Self, and it is able to create “slot” for objects and to attach methods to them.
  2. 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.
    I have done some basic stuff using the Java Native Interface (JNI) and the “id compiler” seems to me simpler to use.
  3. Very very very flexible.

You can find more interesting example like:

  • A port of the Squeak Virtual Machine (sqvm). The VM is able to interpret a “mini” squeak image even if is not very fast.
  • An X11 Integration example
  • Some more complex examples based on Jolt, an implementation of Coke.

The id compiler (idc) works well under cygwin too, so it seems to me quite independent from the O.S. and the available libraries.

This approach is far more promising then the interpreted one out of there; more notably, FScript is very nice, but is interpreted and limited to a Cocoa implementation.
Id instead is still a bit slow, but you can tune it where you need using a snippet of C-code.

About Giovanni Giorgi
Born in the 1974, he is working as a professional IT Software Architect from year 2000.
In the free time he likes doing trip and reading books.
His blog has some interesting photo about his trips and he uses Smalltalk from 1996

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: