So-o defines a functional layer which adds an object-oriented programming model to a structured programming language. Inspired by Smalltalk, fruits of a long practice of Objective C and different Lisp dialects, So-o is complete, simple and light, easy to understand.


So-o has 3 functions: defclass which defines a new class, sendmsg which is systematically used to send a message to a class or an instance, and supersend which runs a method inherited from a superclass. Simply object-oriented!

So-o proposes a standard implementation in several languages. The code in PHP is less than a 1000 lines. The code in C in just about 1500 lines.

namespace Hello;

require_once 'So-o.php';

defclass('Hello', null, 1, null, null, null, array('hello'));

function i_hello($self) {
    echo 'Hello from So-o!', PHP_EOL;

    return $self;
$ php -a
php > require_once 'Hello.php';
php > $hello=sendmsg($Hello, 'new');
php > sendmsg($hello, 'hello');
Hello from So-o!

A game of poker • A complete program written in PHP with So-o.

Read the PHP manual

#include "So-o.h"

class Hello;

static instance i_hello(instance self) {
    printf( "Hello from So-o!\n" );

    return self;

void defclassHello() {
    selector _i_messages[] = {
        "hello",    METHOD(i_hello),
        0, 0

    Hello = defclass("Hello", 0, 1, 0, 0, 0, _i_messages);

A simple main to illustrate how the Hello class is used:

#include "So-o.h"

#include <stdlib.h>

extern class Hello;

extern void defclassHello();

int main( int argc, char *argv[] ) {
    instance hello;


    hello = (instance)sendmsg(Hello, "new").p;

    sendmsg(hello, "hello");

    sendmsg(hello, "free");

    exit( 0 );
$ gcc -O -fstrength-reduce -finline-functions -fomit-frame-pointer -c test-Hello.c
$ gcc -O -fstrength-reduce -finline-functions -fomit-frame-pointer -c Hello.c
$ gcc test-Hello.o Hello.o libso-o.a -o test-Hello
$ test-Hello
Hello from So-o!

A game of poker • A complete program written in C with So-o.

Read the C manual