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.
PaulHoule 1 hours ago [-]
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
and wonder if that could be harmonized with JS exceptions
This strategy though competes with writing a Lisp which gives you better metaprogramming.
terminalcommand 1 hours ago [-]
What about writing primitives using WASM?
jstanley 6 hours ago [-]
What about an array of numbers? What are the nasty compromises?
veltas 3 hours ago [-]
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.
jstanley 2 hours ago [-]
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.
shakna 4 hours ago [-]
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.
jstanley 2 hours ago [-]
If you're making it in JavaScript then you won't be doing that anyway.
masoncarpenter 3 hours ago [-]
[dead]
bitwize 14 hours ago [-]
"Writing things in a programming language" now seems to have the same quirky old-internet charm as "Flash games".
pjmlp 7 hours ago [-]
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.
e12e 3 hours ago [-]
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.
pjmlp 3 hours ago [-]
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.
conartist6 2 hours ago [-]
Yes, and as we all know the printing press was the dawn of a new era where nobody could read and write.
Fuckin' morons.
pjmlp 1 hours ago [-]
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.
conartist6 38 minutes ago [-]
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
e12e 1 hours ago [-]
Touch aggressive, no?
conartist6 46 minutes ago [-]
Yes indeedy! Unfortunately all the placation work has been taken over by models.
Rendered at 16:31:58 GMT+0000 (Coordinated Universal Time) with Vercel.
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.
I'm rather exited by the prospect that everyone will be a developer - and so actual users, not merely consumers, of computers.
Fuckin' morons.
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.