Live data from Hacker News

Collapse OS – Why Forth?

collapseos.org

141–150 of 172 posts

Re: Collapse OS – Why Forth?

#141

I think I've had my own moment of clarity that spans both Forth(s) and Lisp(s) and explains why neither is as common as other languages. In most common languages, there is a complicated base spec that covers many cases and defines a broad range of affordances, plus libraries and libraries that expand on an already fleshed out collection of tools and etc. Forths and Lisps give you the core of an environment, and let/e…

Lisp peaked very early, and grew at a voracious pace compared to progress in hardware. The result was that it required "big iron". Lisp was a victim of the same process that killed the mainframes: a rebooting of the computer industry with cheap, but (initially) under-powered microcomputers, to which legacy systems were not able to migrate.

There also arose a new generation of hackers brought up on the new microcomputers who didn't care for, know or else even have access to legacy systems. As microcomputers showed signs of advancement, old hackers who had learned how to make things fit into small memories 15 years prior brandished their skills, which popularized tools like Pascal and C. Turbo Pascal for MS-DOS PC's fit a compiler and IDE into under forty kilobytes.

In the 1980's, people who wanted to use their Lisp techniques to deploy into the microcomputer market were faced with rewrites. A blatant example of this is CLIPS: an expert system written in C which retains the Lisp syntax of its predecessor. https://en.wikipedia.org/wiki/CLIPS . CLIPS was inspired by a Lisp-based system called OP5. But that itself had also been rewritten into Bliss for speed: https://en.wikipedia.org/wiki/OPS5 .

Re: Collapse OS – Why Forth?

#142

Earlier quoted context omitted.

You are giving technical merits way too much credit. People will put up with whatever bullshit as long as there is demand and helps them get a job. The thing is, UNIX was a massive success, and it happened to be written in C. Since then, all successful languages had to have a familiar syntax with the host language. It was UNIX that killed the Lisp Machine (by being given away for free). Programming languages never go…

Unix wasn't given away for free; it was strapped by AT&T licensing and you needed hardware that certainly wasn't free, and not still not affordable to individual consumers. But Unix was a resource-efficient system that scaled down to cheaper hardware with less RAM. Even the dyed-in-the-wool Lisp enthusiasts headed by Richard Stallman were compelled to reproduce Unix, even though their stated goal was to have a system…

It was given to universities for free iirc

Re: Collapse OS – Why Forth?

#143

Earlier quoted context omitted.

There's a difference between “not unreasonable” and “reasonable”.

Can you provide more details?

“not unreasonable” expands to “You could provide reasons that seem valid, even if I don't agree that they support your conclusion.”

“reasonable” expands to something more like “The reasons you have provided support your conclusion.”

“reasonable” can work in this case, but it doesn't state as clearly that the speaker disagrees with your conclusions.

In a more general sense the “not un-” pattern is a marker for something that is qualitatively similar to the corresponding simple positive attribute (e.g. “reasonable” or “popular”) but not to the extent of the category of things fitting that simple positive attribute. That is, category “reasonable” is a strict subset of category “not unreasonable”.

Re: Collapse OS – Why Forth?

#144

Earlier quoted context omitted.

Definitely read (at least the first chapters of) the Z80 cpu manual: http://z80.info/zip/z80cpu_um.pdf It gets a bit dry when it gets to the bit that documents the individual instructions, but the overview before that point is well worth reading. Once you've done that and you're trying to write code, this page is a good reference for the instructions: http://clrhome.org/table/ To build a scavenged machine, you'll nee…

Thank you for your thorough answer. Especially when you frame it like that, the RC2014 sounds like like a fun next step. I'll definitely look into it.

You're welcome.

For help and support, the rc2014-z80 mailing list is quite active: https://groups.google.com/forum/#!forum/rc2014-z80

And I'd also happily receive RC2014 or Z80-related questions by email (available in profile), although I'm not much of an expert compared to many of the people who are active on the mailing list.

Re: Collapse OS – Why Forth?

#145

Earlier quoted context omitted.

Note that Forth also supports locals. These will consume and remove N members from the stack so you can summon them as needed prior to calling the words. But as someone that really got into Forth this year, I can assure that it does get better once you get more familiar with the language. I used to write commenting the stack effects on each line and now I barely need them as I write words in one sitting without that…

It's been a long time since I did anything substantive with Forth, but, as I recall, the big problem here is that most Forth guides get so excited to show you how much rope the language gives you that they forget to teach you how not to hang yourself with it. So you're kind of left to figure out all the little idioms and best practices for stack management all on your own.

>> So you're kind of left to figure out all the little idioms and best practices for stack management all on your own.

That was my experience learning Forth in the 80's. Initially I tried to add compositional features I was familiar with from APL and Lisp. I raged against the limitations of the cell and schemed to use a typed stack. Eventually I became one with PAD and was able to ALLOT peace to my code. At some point I ranted on how the idiom of counted strings could be generalized to all sorts of useful sin and had an epiphany. 2ROT on!

Re: Collapse OS – Why Forth?

#146
post #9

First time i hear about this project and i love it. I often talk with a friend who's an historian, and that makes me realize how our relationship with time, as an industry, is extremely short sighted. The internet archive is an immensely valuable project, as well as all the websites archiving old documentation, etc. But i don't think a lot of people realize the value of things they're destroying everytime they execut…

DELETE statement... That's far too obvious. With every UPDATE statement you are forgetting the past, yet it's still the goto DB paradigm! It's okay to constantly lose information apparently...

And it's not like we don't have alternatives. There is Datomic of course, but also juxt/crux and DataHike.

Re: Collapse OS – Why Forth?

#148

If I had to put my finger on why Forth is hard for most programmers, it's like this: the structured program theorem suggests using sequence, selection, and iteration to control program logic. Assembly code on hardware architectures will assign all meaning sequence-relative, late-binding the selection and iteration. Forth doubles down on this sequence-first approach through a more versatile assignment mode(the stack)…

> Forth is hard for most programmers

It's pretty hard to make that judgment. I'd guess at least 99% of programmers have never used Forth.

Re: Collapse OS – Why Forth?

#149

Earlier quoted context omitted.

You are giving technical merits way too much credit. People will put up with whatever bullshit as long as there is demand and helps them get a job. The thing is, UNIX was a massive success, and it happened to be written in C. Since then, all successful languages had to have a familiar syntax with the host language. It was UNIX that killed the Lisp Machine (by being given away for free). Programming languages never go…

Unix wasn't given away for free; it was strapped by AT&T licensing and you needed hardware that certainly wasn't free, and not still not affordable to individual consumers. But Unix was a resource-efficient system that scaled down to cheaper hardware with less RAM. Even the dyed-in-the-wool Lisp enthusiasts headed by Richard Stallman were compelled to reproduce Unix, even though their stated goal was to have a system…

Stallman decided to reimplement Unix because it was popular, not because it was somehow better suited to the hardware.

One of the first GNU programs he released was indeed his "system running Lisp"; it was called Emacs.

Re: Collapse OS – Why Forth?

#150
I'm surprised that no one has mentioned https://flashforth.com/

There is no intriguing backstory for it, like for CollapseOS, but it's a ~6 kiloword, practical 4th environment for Microchip PIC microcontrollers, which are a lot simpler than Z80, btw... The source code is trivial to understand too. My father is still using it daily to replace/substitute Caterpillar machine electronics or build custom instruments for biological research projects.

We started with Mary(Forth) back then, when the first, very constrained PIC models came out, with 8 deep stack and ~200 bytes of RAM. Later we used the https://rfc1149.net/devel/picforth.html compiler for those, which doesn't provide an interactive environment.

I made a MIDI "flute" with that for example, which was fabricated from sawing out a row of keys from a keyboard and used a pen house as a blow pipe and a bent razor with a photo-gate as the blow-pressure detector...

There are more minimal Forth OSes, which might be more accessible than a Z80-based one.

I would think those are more convenient for learning, how can you have video, keyboard and disk IO, an interactive REPL and compiler in less than 10KB

I remember, I played a lot with https://wiki.c2.com/?EnthForth

But if you really want to see something mind-bending, then you should study Moore's ColorForth! I found it completely unusable, BUT I've learnt immense amount of stuff from it: https://colorforth.github.io/

There are more usable variants of it, btw. Also worth looking into Low Fat computing: http://www.ultratechnology.com/lowfat.htm I think it's still relevant today.

Post reply on HN