I think the first question I've got for JavaScript Forths is how you'd handle addresses, bytes, etc., because that's a staple of any conventional Forth, necessary to create tables, arrays, and handle strings. There are lots of ways of doing it but there are some nasty compromises required for a more standard-looking Forth.
A FORTH in Javascript should do what Clojure does for Java.
The object on top of the stack should be a Javascript value, numbers are all doubles, and you can use strings, arrays, objects-as-dicts and in fact ordinary objects you could write something like
You could use all the metaprogramming tricks you use in other FORTHs, be able to do anything Javascript can do, I don't think it would be too hard to unpack the stack and turn a word that takes N parameters from the stack into a Javascript function the JS compiler can make fast
Well if the array of numbers are bytes then that has a pretty significant overhead, and losing a lot of performance for dealing with larger numbers or floats even. If it's not then you're complicating handling of strings and writing off most conventional forth code by not using byte addressing. Etc.
Some Forths work by directly writing machine code. You need to add a fair bit of machinery to be able to turn a JS number array into an executable piece of memory that can be hotpatched into other pieces.
That you can't execute machine code from JavaScript is a consequence of using JavaScript, not a consequence of using an array to store a bunch of numbers.
Unfortunely, I forsee eventually LLMs will become good enough to deliver the 4GL initial vision, we are already seeing that take shape in iPaaS products, or code generation that is as readable as minified C code for IOCCC entries.
It won't happen, a few lucky ones will press the buttons on the software factory machines, or be called into Wonka Factory (aka AI Labs), while everyone else has to find a new job.
The printing press did nothing to literacy for those that could not attend school.
If anything, it allowed the creation of publishers as gate keepers of which books would be printed, and naturally placed the monks out of job doing beautiful renditions on the pages.
"Not seeing a comment about LLMs on a HN item that has nothing to do with LLMs" now seems to have the same quirky old-internet charm as "marquee tags".
Do you mean to say comments on LLMs - where not warranted - is about as welcome as marquee tags were?
Or do you genuinely feel such comments are missing?
I kind of agree with the first - and yet, I have an LLM related comment.
Just the other day I accidentally implemented a Forth - due to Google's LLM (search) result thingy - and its sort of interesting to contrast with this (ops) human written essay.
I think the first question I've got for JavaScript Forths is how you'd handle addresses, bytes, etc., because that's a staple of any conventional Forth, necessary to create tables, arrays, and handle strings. There are lots of ways of doing it but there are some nasty compromises required for a more standard-looking Forth.
A FORTH in Javascript should do what Clojure does for Java.
The object on top of the stack should be a Javascript value, numbers are all doubles, and you can use strings, arrays, objects-as-dicts and in fact ordinary objects you could write something like
You could use all the metaprogramming tricks you use in other FORTHs, be able to do anything Javascript can do, I don't think it would be too hard to unpack the stack and turn a word that takes N parameters from the stack into a Javascript function the JS compiler can make fastThere is some precedent:
https://www.forth.org/svfig/kk/11-2019-O'Connor.pdf
I just realized there is exception handling in FORTH now
https://forth-standard.org/standard/exception
and wonder if that could be harmonized with JS exceptions
This strategy though competes with writing a Lisp which gives you better metaprogramming.
What about an array of numbers? What are the nasty compromises?
Well if the array of numbers are bytes then that has a pretty significant overhead, and losing a lot of performance for dealing with larger numbers or floats even. If it's not then you're complicating handling of strings and writing off most conventional forth code by not using byte addressing. Etc.
A typical Forth machine has about 64k bytes of RAM, I don't think it's a big deal if you're running JavaScript anyway.
Some Forths work by directly writing machine code. You need to add a fair bit of machinery to be able to turn a JS number array into an executable piece of memory that can be hotpatched into other pieces.
If you're making it in JavaScript then you won't be doing that anyway.
And doing it a different way, is the point I was making?
It comes with an overhead. You have to take a different architecture. You can't do things the same way.
That you can't execute machine code from JavaScript is a consequence of using JavaScript, not a consequence of using an array to store a bunch of numbers.
What about writing primitives using WASM?
[dead]
"Writing things in a programming language" now seems to have the same quirky old-internet charm as "Flash games".
Unfortunely, I forsee eventually LLMs will become good enough to deliver the 4GL initial vision, we are already seeing that take shape in iPaaS products, or code generation that is as readable as minified C code for IOCCC entries.
Why unfortunately - if they actually deliver?
I'm rather exited by the prospect that everyone will be a developer - and so actual users, not merely consumers, of computers.
It won't happen, a few lucky ones will press the buttons on the software factory machines, or be called into Wonka Factory (aka AI Labs), while everyone else has to find a new job.
Yes, and as we all know the printing press was the dawn of a new era where nobody could read and write.
Fuckin' morons.
The printing press did nothing to literacy for those that could not attend school.
If anything, it allowed the creation of publishers as gate keepers of which books would be printed, and naturally placed the monks out of job doing beautiful renditions on the pages.
Uh huh so I'm taking that as a "no" from you on the impact of the printing press as a technology over the last 500 years
Take it in whatever way makes you happy.
Touch aggressive, no?
Yes indeedy! Unfortunately all the placation work has been taken over by models.
"Not seeing a comment about LLMs on a HN item that has nothing to do with LLMs" now seems to have the same quirky old-internet charm as "marquee tags".
Do you mean to say comments on LLMs - where not warranted - is about as welcome as marquee tags were?
Or do you genuinely feel such comments are missing?
I kind of agree with the first - and yet, I have an LLM related comment.
Just the other day I accidentally implemented a Forth - due to Google's LLM (search) result thingy - and its sort of interesting to contrast with this (ops) human written essay.
https://hypertekst.net/forth/
Fair warning - my current homepage is an experiment drenched in AI - at best it's probably an acquired taste.
It's not intentionally terrible, however.
I don't care about your LLM use. It's not interesting in the slightest!
Thank you for taking the time to say so.
Sorry mate, but that article was from 2024, which means it's a relic of a different world which has since passed away.
People are still making software. It is you who practically passed away.