Live data from Hacker News

Forth: The Hacker’s Language

hackaday.com

91–100 of 111 posts

Re: Forth: The Hacker’s Language

#92
post #74

Earlier 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.

...What dev board? The GreenArrays one?

Re: Forth: The Hacker’s Language

#93
post #85

Earlier 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…

Ah, I encountered Scatch 2.0. I'll definitely check 1.4 out, it looks a lot more accessible and reasonable. I would have loved to have encountered something like this at 14 or 15.

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

#94
FORTH variation #1,000,001: I took John Walkers' AtLast as a core, and extended it in several directions, some I believe quite significant. My use case for FORTH has been as a live debugger that lets me interact with a running Real Time system, an environment where breakpoints are not very useful (except in crashes) because they only allow for post-mortem examination, but a RT system needs to be watched while it is runnung to more quickly discern pathologies.

Extensions 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

#95
post #4

I 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?

Depends. How do you feel about math?

http://www.math.ubc.ca/~cass/graphics/manual/

Re: Forth: The Hacker’s Language

#96
post #81

Earlier 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.

I loved the asm way in PC compilers used to support inline asm.

    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

#97
post #60

Just 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.

Amazing book. This is what got me started in implementing my own FORTH in the early 1980s.

Re: Forth: The Hacker’s Language

#98

Forth 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.

One might even say that the language is a bit of a hack. :)

Re: Forth: The Hacker’s Language

#99
post #82

Earlier 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…

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

Re: Forth: The Hacker’s Language

#100
post #99
post #82

Earlier 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

I've heard the BBC BASIC was quite a lot better, but I've never worked in it myself...
Post reply on HN