22 comments
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
>> {"a": [1, 2], "b": "hello" }
>> DUP
>> "a" GET{ 0 GET[
>> .
1
>> "something" "c" PUT{
>> .
{"a": [1, 2], "b": "hello", "c": "something" }
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.
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.
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.
Read the full thread on Hacker News →
Related stories
- Lobsters · 3 points · 1 day ago
- Lobsters · 1 points · about 13 years ago
- Lobsters · 3 points · almost 8 years ago
- JavaScript for Kids | No Starch Pressnostarch.comLobsters · 1 points · almost 12 years ago
- Hacker News · 1 points · 2 months ago
- DEV Community · 11 points · 2 months ago