James Hague jamesh@REDACTED
Mon Apr 22 17:21:49 CEST 2002

An interesting post from Lambda the Ultimate, included below.  I've thought
in the past about how something like this could work for Erlang.  It would
be really nice to be able to write BIF-like extensions without having to
modify the runtime system and without having to stream everything through a
binary port.  For example, there's no good way to tack a speedy matrix
multiply into the Wings3D code.

Pyrex - A language for writing Python extension modules 
Pyrex is a language specially designed for writing Python extension modules.
It's designed to bridge the gap between the nice, high-level, easy-to-use
world of Python and the messy, low-level world of C...
Pyrex deals with the basic types just as easily as SWIG, but it also lets
you write code to convert between arbitrary Python data structures and
arbitrary C data structures, in a simple and natural way, without knowing
anything about the Python/C API. That's right -- nothing at all! Nor do you
have to worry about reference counting or error checking -- it's all taken
care of automatically, behind the scenes, just as it is in interpreted
Python code. And when fully implemented, Pyrex will let you define new
built-in Python types just as easily as you can define new classes in

The way this works is that you write code in a Python-like language (Pyrex),
which allows you to access C data types directly, as well as standard Python
data. The Pyrex code is then compiled into C.

Seems like a nice way to extend a language. Better than having to use a
different language completely, as when writing extension modules in C or

In some sense this is reminiscent of inlining and macros.

More information about the erlang-questions mailing list