"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog

Wednesday, January 16, 2008

On the concept of a "stable layer"

Ola Bini writes about the concept of a "stable layer" for language implementations, especially (I gather) where the "stable layer" is underneath a "dynamic language" used by application programmers. I am using quotes because these terms do not have to my knowledge widely accepted, rigorous definitions. That's OK, coming to a common understanding of these terms is part of it.

I interpret his use of "stable layer" as perhaps an "implementation layer", what is used to implement the language one truly wants to use. Maybe they are the same language. If you want to program in Java or in Scala, then it would seem in these terms, the stable and the "top" (?) layer are one and the same.

CPython, CRuby, Jython, and JRuby have as "stable layers": C, C, Java, and Java, respectively. But this arrangement is not necessary for dynamic languages generally. My understanding is PyPy is implemented in Python and Rubinous is implemented in Ruby. (Excuse me if I messed that up a bit.)

As a couple of other data points on suitable languages for a "stable layer" consider the implementations of Squeak Smalltalk and Gambit Scheme. Both of these languages are implemented in subsets of themselves. Both of those subsets compile to C primarily to avoid implementing special translators for each instruction set architecture they run on.

Those subsets (of Smalltalk and Scheme) are essentially as efficient as C. But they are each "dynamic languages". And the stability of both implementations can be measured now in *decades*, regarding how long they've been around, used in "real" systems. Gambit in particular having very good performance because *any* application code can be compiled this way, and Squeak could take this same approach if desired.

1 comment:

Glyph Lefkowitz said...

PyPy is a complex beast, but it has a similar arrangement to Squeak and Gambit. Large portions of the "interesting" parts of PyPy are implemented in RPython, i.e. "restricted python", a subset of Python which is more amenable to translation to low-level languages. (I don't say "C", although C is an option, because some of the translations are direct to some VM's bytecode or even machine code, in the case of the JIT.)

Blog Archive

About Me

Portland, Oregon, United States
I'm usually writing from my favorite location on the planet, the pacific northwest of the u.s. I write for myself only and unless otherwise specified my posts here should not be taken as representing an official position of my employer. Contact me at my gee mail account, username patrickdlogan.