Writing a primitive Forth in JavaScript (2024)

(onirom.fr)

30 points | by dverlaeckt80 16 hours ago

3 comments

  • veltas 3 hours ago
    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.
    • jstanley 3 hours ago
      What about an array of numbers? What are the nasty compromises?
      • veltas 57 minutes 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 5 minutes 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 1 hour 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 5 minutes ago
          If you're making it in JavaScript then you won't be doing that anyway.
  • masoncarpenter 1 hour ago
    [dead]
  • bitwize 11 hours ago
    "Writing things in a programming language" now seems to have the same quirky old-internet charm as "Flash games".
    • pjmlp 4 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 49 minutes 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 41 minutes 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.