Other things besides drivers OpenFirmware can do.
April 14, 2006 7:02 PM
Subscribe
Can you make something besides a driver run in OpenFirmware?
I know someone's going to answer this fairly quickly, but is it possible to both write a small network program (think: dial home), and embed it into the OpenFirmware of a Powerbook, without seriously causing some dammage, but making it almost impossible to remove?
Furthermore, is Forth a difficult langauge to learn from the perspective of someone that understands C+?
posted by plaidrabbit to computers & internet (11 comments total)
FORTH isn't really a high level language. The right way to think of it is that it's a high level assembly language for a stack architecture machine which is simulated by the Forth runtime system. It isn't correct to refer to Forth as being interpretive, because it's a different approach than that. But it isn't compiled, either. And FORTH code doesn't look anything like C++, because everything, everything, is in postfix notation.
You enter expressions in RPN, for instance. And if you want to call a function and pass it parameters, you have to push the parameters on the stack before making the call. If the function has a return value, it leaves it on the stack when it returns.
In some ways it's even closer to the hardware than C. It doesn't directly support arrays, for instance. If you want to implement an array, you do your own address offset calculations.
And if you leave the stack dirty, all hell breaks loose. Bug rates per thousand lines of code for FORTH are more similar to ASM than to C++, and like ASM each line of code does much less. So debugging FORTH code is an exercise in frustration.
FORTH is an abortion, and there's a damned good reason it never took off. But like all computer abortions, there is (or used to be) a hard core of fans who thought (and think) that it's God's Gift to Computer Science.
Is it a difficult language to learn? Depends on the person, I would say, but if you've never written any significant amount of assembly language, I suspect you'll have a really hard time with it. Your experience with C++ will be a hindrance, not a help, because nothing in FORTH is remotely like the same functionality in C++.
posted by Steven C. Den Beste at 7:19 PM on April 14, 2006