Hacker News new | ask | show | jobs
by jecel 1427 days ago
The main goal for Slang was to be able to use the Smalltalk debugger instead of something like gdb. Since you are essentially writing C but with a Smalltalk syntax the code itself is not any simpler, so it is all about the tools.
1 comments

Something about that I'm missing. You'd use something like gdb for debugging running C code but the Smalltalk debugger works in the image so which C running code would it be debugging?
Slang is Smalltalk-80 written as if it were C: all methods in a single class so they can be translated to C functions, no object allocations and so on.

This means that you can run the code as Smalltalk-80 inside Squeak and use all the tools like the Smalltalk debugger. When you are sure that it is working, you translate it to C and compile it to machine code. Now you would use GDB to debug that but in theory you won't have to as the code should just work.

Note that running the Slang version of the VM inside Smalltalk-80 gives you a fully functioning Smalltalk that is about 600 times slower than the Smalltalk it is inside of. The idea for Squeak was that machines had become so much faster than in the 1970s/1980s that even with this slowdown you could actually use the simulated Smalltalk enough to find all bugs.

On earlier computers such a simulation would be so slow that it would take many minutes for a menu to be drawn on the screen when you pressed a mouse button, for example. You would not get enough done to run into all the bugs. By the late 1990s this was no longer the case.