Starting Forth
forth.com
forth.com
1 - http://www.openfirmware.info/Forth/FCode
2 - http://www.ebay.com/sch/items/?_nkw=olpc+laptop&_sacat=&_ex_...
http://www.forth-ev.de/wiki/doku.php/en:projects:gforth-andr...
That tells you how to do graphics hacks and so on. I had fun with that on my OLPC. I optimized the Forth console to scroll using hardware BLIT (much faster than CPU copy of the framebuffer) and I ported Squeak Smalltalk to run directly on OFW using hardware graphics primitives e.g. for the mouse pointer.
Fun times :)
I guess dead simple design, low consumption is attractive here.
Perhaps a natural question, is there a software framework that mimics this way of building horizontally scalable services?
Your base language already has variable assignment, loops, recursion? Great, you don't have to deal with that. Type checking? Wonderful, don't have to go read up on type inference
Perhaps this article[1] can help answer the question (BTW, the title of the page belies its applicability). Check out Figure-1 specifically.
> How does a full programming language act as a base for a DSL, which is usually more limited than a programming language?
IMHO, this is what makes Forth both beautiful and mind bending, as Forth is a "full programming language" in which programs/systems written in it are expressed as a DSL defining the system itself. If that sounded recursive, then you're well on your way to grokking Forth :-).
A good place to learn more (if you have some familiarity with Lisp) is: http://stackoverflow.com/questions/24282153/comparison-of-co...
I guess the other huge nice thing abort Forth for DSLs is that it is (unlike assembler or C), an interactive language, even on the most stripped down platforms (like bare bones $0.50 8-bit MCU stripped down), and still encourages the sort of REPL experimentation typically only seen in much much higher level languages. All of this comes at a big price though, in that the caliber of developer required to wield Forth in a sane manner tends to be very high.
FORTH is a bit like smalltalk in that you usually work in an interactive environment and save images. FORTH code compiles down to essentially a jump table and so it is also really, really efficient, space wise. You can decompile code easily and modify it in your image.
If you were trying to write a control language for some small embedded device, it would be ideal. If you were trying to write a DSL for configuring a build system (or something like that) it would be less nice ;-)
My first few paying jobs (when I was in university) was writing FORTH code, but that's a very long time ago ;-) I'm still quite nostalgic about it even though I've forgotten almost everythng I once knew.
(Also, curiously, gave me an increased respect for K&R C, which allows minimalist programming in a way that ANSI C doesn't.)
Edit: This has made me wonder about a NeWS-like server sitting on top of OpenGL and using an interactive PostScript like language.....
I have often thought a NeWS-like server would be a fine replacement for a lot of web stuff.
Among the reasons: no interest in bytecode (UEFI now has EBC), no ACPI support (IEEE1275 predates ACPI by a decade, Intel didn't bother), protecting Intel's "Independent" BIOS Vendors from having to compete in an existing market (there were several OpenFirmware vendors).
Most OF implementations are now open source, we collected them at www.openfirmware.info.
I've done robotics programming in Forth. I do not expect to use it again.
But these days, embedded full Linux systems are just too cheap to not be the default option when you want to develop on the device itself.
I think there's now Rust for the Arduino Due, which is ARM-based.
As early as 15 years ago a number of our embedded products using 8 bit processors were programmed in assembler and/or Forth. This quickly became challenging in terms of product maintenance (assembler) and finding qualified experienced developers (assembler and Forth). I found myself in the difficult position, as CEO, of not being able to remove these responsibilities from my desk. And so we ported all of our code from assembler/Forth to C. In that process we improved nearly every technical and business metric. The port took months but it was well worth it.
I still think every programmer needs to start with assembler wrangling processor architecture internals "by hand", move on to Forth (or a TIL), then Lisp and C. I am sometimes in horror to come across programmers for whom every solution requires bloated, inefficient object oriented code.
https://rwmj.wordpress.com/2010/08/07/jonesforth-git-reposit...
Here's the problem I'm trying to solve (still in the tinkering stage). I have an embedded processor with small on-board SRAM but huge external address space and a NAND flash. Can't add external RAM. http://www.atmel.com/tools/ATSAM4S-XPRO.aspx
Would like to be able to run more code than can fit in the SRAM. With C, I was looking at the old style overlays. https://en.wikipedia.org/wiki/Overlay_%28programming%29
Also want to be able to support downloadable code modules.
Was looking into a Tcl dialect http://wiki.tcl.tk/1363 but I keep thinking Forth would be perfect.
This could possibly be optimised in a subroutine threaded Forth so code within each "page" wouldn't have to verify loaded segments.
Implementing a dictionary insertion/optimization routine that packs related routines together to minimise swapping would be an interesting problem, and would probably most easily not be done live but ahead-of-time instead.
In short: Yes, Forth can support the paging you desire if implemented that way.
The new ANS hotness is the "MARKER" word, you just say "MARKER OVERLAY" and then you can just invoke OVERLAY later and it clears things out for you. See Elizabeth Rather's comment here: http://computer-programming-forum.com/22-forth/c67f31fe1e09b...
I suspect this is something to do with different ways of conceptualising programs.
See also oberon, smalltalk, eiffel for more language communities of that kind (the jury is still undecided where haskell ends up); os/2, plan9, l4 when it comes to operating systems/kernels; 6502, m68k, mill for Instruction Set Architectures; (and so on)
Every now and then, us non-mainstreamers tend to sound a bit preachy when we get an audience, I grant that :-)
Jewelers don't build skyscrapers.
A friend of mine who programmed solely in Forth (and who taught me just about everything I know about the language) quipped that 'C is such a great language'. That was his way of saying he considered C to be bloated compared to Forth.