3 ms·
It's been a while, so my memory's a little fuzzy. If I remember correctly, all the code was s-expressions, piped through a scheme (?) preprocessor, and then int
by strags 13y ago
It's been a while, so my memory's a little fuzzy. If I remember correctly, all the code was s-expressions, piped through a scheme (?) preprocessor, and then into the compiler. Many of the basic language constructs were actually macros.
The lower-level language itself was statically typed, and supported pointers and arrays as native types - identical to their C equivalents. Classes either derived from "structure" (unboxed) or "boxed". The boxed types had a class pointer, much like a C++ vtable ptr, but with some more useful introspective data attached.
Runtime linkage was mostly accomplished by patching types' method slots and/or patching a global symbol table. The compiler talked to a MySQL database which was shared by the whole company, so that symbols wound up having unique and consistent ids across all machines. The "listener" ran on a PS2 devkit, and essentially just accepted object code to link and execute. The REPL worked by having the compiler compile each expression, squirt the MIPS object code over to the PS2, have the PS2 link and execute it, and return a result, which the compiler would then print (possibly peeking into the PS2's memory in order to display more useful information). Similarly, you could place your cursor inside a block of code, hit CTRL+T and have just that function/method updated on the target. (This was back when edit-and-continue was still something of a novelty!)
The ABI was close enough to C that GOAL and C could call each other almost directly (the MIPS GP register had different meanings in GOAL vs C code, and so had to be patched up).
You could also pretty much mix GOAL and assembly, and we frequently did. GOAL's backend was never going to be as efficient as gcc's, but the massive increase in productivity it provided meant that we could devote much more time to optimizing the stuff that really mattered.
I think Andy Gavin's on here somewhere - he should really write an article about it if he hasn't already :)