Earlier quoted context omitted.
If you want to build an SBC, than Forth is the language to write that code in.
SBC meaning ? single board computer ?
Forth: The Hacker’s Language
91–100 of 111 posts
Re: Forth: The Hacker’s Language
#92Earlier quoted context omitted.
Worth playing; if you enjoy programming challenges within limited environments, you would be hard pressed to find better games than the Zachtronics set of games.
If I had time to spare, I'd actually order the development board. The architecture is unique and fascinating.
Re: Forth: The Hacker’s Language
#93Earlier quoted context omitted.
I read through the recent thread on teaching kids to code ( https://news.ycombinator.com/item?id=13499626 ) and was mildly perplexed at how seemingly successful Scratch has been. It wasn't until the 2nd or 3rd time I'd used it that I actually figured out how to make sense of it and run something (for Scratch's definition of "run"). To be honest I've progressed extremely slowly with CompSci/programming over the past 1…
When I used Scratch 1.4, I don't recall the UI being too bad, and it ran pretty fast: Smalltalk is pretty good at that. But I'm generally pretty good at picking up these sorts of things, and my computer wasn't particularly slow. If you want a Real Language presented the same way, Snap! (descended from BYOB) is essentially a Scheme in Scratch's clothing. But the two real draws of Scratch were its hackability and its c…
I suspect the reason Scratch felt slow to me is that 2.0 is some kind of HTML5 and/or Flash mess now - you're right, Smalltalk is really fast. I spun up Squeak to check something on this T43 yesterday, and everything was really snappy. I have no reason to expect Scratch will be any slower.
Also, I wouldn't be surprised if a reasonable bit of the exploration everyone did was motivated by the fact that they were "hacking" the platform :P
There seems to be a sad lack of excellent online communities nowadays; I've long looked for sites to complement HN, but without success.
I just had a look at Snap! which is interesting. It definitely flatlines this laptop though, I had to try it on a faster machine. But I'm running the tree animation demo right now, and it looks awesome....
Re: Forth: The Hacker’s Language
#94Extensions that saved me the most agony:
1: Use of stack frame comments to actually define local variables and enforce the in - out stack transform. While at this I also added the comment string to the word definition in an additional help link. Thus:
[:] do_it ( in1 in2 -- out : return in1 * in2 * 2 ) local lv : lv_helper 2 * ; in1 @ in2 @ * lv_helper out ! [;]
> help do_it in1 in2 -- out : return in1 * in2 > 3 6 do_it . 36 >
Note the [:] and [;] redefs for compiler words, had to do this to accommodate nesting, locals, stack frames, while not compromising regular FORTH.
all variables are local in scope to the containing word. Defining variables inside ditto. Had words for listing contents of these too.
I later extended this to include nested word definitions, dynamically allocated variables, and stack frames that will unwind these on execution error. Gone were stack frame size errors, a missed dup or drop no longer fatal, indeed dup and drop not really necessary any more.
2: Structured data debugging aides: a few words and a C header parser allowed me to dump or modify readable contaents of application structs, and to call into application functions.
3: along the same lines of nested definitions, I was able to associate sub-dictionaries with graphical views along their heirarchy. This was a later addition, applied to VNOS. Lots of little things became manageable with this paradigm. In particular, allowed me to do a scoped local console (as a debug object instantated in a View), and to insert message overrides into the VNOS messaging mechanism, effectively adding what turned out to be a really powerful scripting system. Done as an object too - current version includes Perl 5 and Lua (almost ready).
And yes, concurrency is a concern, and being sure not to call non-re-entrant (errant:) functions, but hey, ypu'd likely be surprised at how good a pattern recognizer ther Human Brain is here.
Over-all, I think I used this system with a good half-dozen different CPU architectures and their OS's, also in the high level VNOS GUI (originally put my FORTH into it for debugging purposes, but that was rapidly out-grown).
Re: Forth: The Hacker’s Language
#95I came to Forth-like languages via PostScript, which has the advantage of a huge built-in graphics library. It very naturally introduces concepts like higher order operations, code as data and data as code.
Can you reccomend any books on PS?
Re: Forth: The Hacker’s Language
#96Earlier quoted context omitted.
Most C compilers do, but those are language extensions, not defined on the language's standard thus not portable across compilers.
Yep. If nothing else, just about all of them have the asm keyword. That's non-standard (but almost always present) in C compilers, and "conditional" in C++ (i.e. the keyword is in the standard, but the semantics are implementation-defined). And yeah, it's a given that it's going to be non-portable. Given asm, implementing a Turbo C-style int86() function seems pretty trivial. It might even be doable as a macro.
asm {
mov ax, 0x0013
int 0x10
}
Can't really like the way clang and gcc asm work, even it it means giving more info to the optimizer.Re: Forth: The Hacker’s Language
#97Just saw recently that the classic FORTH tutorial is available online: Starting FORTH — Online Edition: https://www.forth.com/starting-forth/ I had read it and played around with FORTH on a microcomputer some years ago. Fun language. Thinking FORTH, a more advanced book, also by Leo Brodie, is also linked to from the above URL.
Re: Forth: The Hacker’s Language
#98Forth is a hacker's language only when we take a narrow definition of "hacker" as someone who cares about making a device field-programmable in the easiest, smallest way that doesn't completely suck, and can somehow get things to work without caring what the code looks like or whether anyone understands it, including the same hacker seventeen months later.
Re: Forth: The Hacker’s Language
#99Earlier quoted context omitted.
For Forth, that's an easy answer: when you think "hacker" you're thinking of people working on the Big Iron. Forth's niche was small machines, so while it had a good bit of popularity on the micros, its influence on the mainframe hackers, with their "we hate micros" ethos, was minimal.
I suspect younger programmers can't even begin to imagine what it was like. I learned to program on the Commodore 64. The default language was (Microsoft) Basic. Line numbers. Only flow control IF, GOTO, and GOSUB/RETURN. No loops, no ability to write functions, nothing like a define or a macro. And then I got my hands on a Forth. Functions. Control structures. Maybe they weren't fancy by modern standards, but they w…
Re: Forth: The Hacker’s Language
#100Earlier quoted context omitted.
I suspect younger programmers can't even begin to imagine what it was like. I learned to program on the Commodore 64. The default language was (Microsoft) Basic. Line numbers. Only flow control IF, GOTO, and GOSUB/RETURN. No loops, no ability to write functions, nothing like a define or a macro. And then I got my hands on a Forth. Functions. Control structures. Maybe they weren't fancy by modern standards, but they w…
For what it's worth, after a bit of research [1], I discovered Commodore Basic 2.0 had simple FOR loops (which I think I used and forgot), and the ability to create functions which encode a single one-variable mathematical expression (which I don't think I ever knew about). [1] https://www.c64-wiki.com/wiki/DEF