Live data from Hacker News

Forth: The programming language that writes itself

ratfactor.com

121–130 of 174 posts

Re: Forth: The programming language that writes itself

#121
post #90
post #16

If you like Forth, but find it challenging to build real stuff with, Factor ( https://factorcode.org/ ) is most or all of the good stuff about Forth designed in a way that's much easier to do things with. It was designed by Slava Pestov (who I think had a big hand in Swift), and honestly it's a lot of fun to build webapps and other programs with, and much less brutal to read than Forth can be.

note to those interested: no apple silicon support.

No, but works fine in Rosetta emulation. And can use native libraries installed via for example the Intel Homebrew.

We do hope to get native aarch64 support in the near future. Let's see.

Re: Forth: The programming language that writes itself

#122
Stepping away from Forth in particular, one of the benefits of a stack-based / concatenative language is that it's easy to implement on constrained hardware. uxn [1] is a great example of that.

And shameless self-promotion, if you're interested in how these kinds of languages compare with more traditional named-based languages, with more theoretical constructs like the lambda calculus and combinatory logic, and with gadgets like a PyBadge — well you're in luck! I gave a talk about exactly that at the final Strange Loop [2].

[1] https://100r.co/site/uxn.html

[2] https://dcreager.net/talks/concatenative-languages/

Re: Forth: The programming language that writes itself

#123
post #18
post #3

Why is it that languages like this don't scale? It's not the first time I see a powerful language that got forgotten. Other examples include SmallTalk and Common Lisp (tiny community). It is because some languages are "too powerful"? What does that say about our industry? That we're still not that advanced of a specie to be able to handle the full power of such languages? I say that because it seems languages that ar…

I think those other languages have real advantages you aren't seeing. —·— The other day akkartik wrote an implementation of the program Knuth used to introduce literate programming to the CACM readers: https://basiclang.solarpunk.au/d/7-don-knuths-original-liter... It just tells you the top N words by frequency in its input (default N=100) with words of the same frequency ordered alphabetically and all words converte…

> And it doesn't really want to talk to the rest of the world—you can forget about calling a Squeak method from the Unix command line.

You seem absolutely certain!

Here's an example of a Pharo Smalltalk program call on the Ubuntu command line, with the calculation result written to stdout --

    /opt/src/pharo-vm-Linux-x86_64-stable/pharo --headless nbody.pharo_run.image Include/pharo/main.st 50000000

    -0.169075164
    -0.169059907

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

    ~
Here's a corresponding Perl program --

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: Forth: The programming language that writes itself

#124
Coco Conn and Paul Rother wrote this up about what they did with FORTH at HOMER & Assoc, who made some really classic music videos including Atomic Dog, and hired Charles Moore himself! Here's what Coco Conn posted about it, and some discussion and links about it that I'm including with her permission:

https://news.ycombinator.com/item?id=36751574

Mitch Bradley came up with a nice way to refactor the Forth compiler/interpreter and control structures, so that you could use them immediately at top level! Traditional FORTHs only let you use IF, DO, WHILE, etc in : definitions, but they work fine at top level in Mitch's Forths (including CForth and Open Firmware):

https://news.ycombinator.com/item?id=38689282

Re: Forth: The programming language that writes itself

#125
post #77

Earlier quoted context omitted.

> Why is it that languages like this don't scale? Stanislav Datskovskiy addressed this rather well: https://www.loper-os.org/?p=69

I've read that a number of times, but this is the first time since the rise of vibe engineering. > I predict that no tool of any kind which too greatly amplifies the productivity of an individual will ever be permitted to most developers. There's a new essay in here, somewhere, about why copilot and AI coding is succeeding at bridging this gap.

It is too risky for companies to rely on a language that have a small pool of programmers. The bigger the company, the bigger the language must be. AI multiplies this availability, not productivity.

Re: Forth: The programming language that writes itself

#126
post #73

Earlier quoted context omitted.

Well, I feel that lot of code is written again and again, just in different languages. If we could automatically compare and translate different implementations, I think it would be beneficial for finding bugs. Everytime somebody comes up with a new programming language, I am like, yeah, so you added these abstraction, just in a different syntax. I think people who come up with new languages should implement the prim…

> Everytime somebody comes up with a new programming language, I am like, yeah, so you added these abstraction, just in a different syntax. I got this feeling too, until I started to explore languages outside of the C/Algol-like syntaxes. There is a wide range of languages out there, from array languages to lisps, and they don't give me the feeling of "just a different syntax" but actually changed the way I think. So…

> they don't give me the feeling of "just a different syntax" but actually changed the way I think.

Not only that, but languages that enable more concise expression of an idea (without losing clarity for readers) reduces the error rates of programs written in them.

It's been proven that when not accounting for constraints imposed by a compiler/interpreter (like the Rust borrow checker), the average error rate per unit size of programs across widely varying languages is constant. So reducing the number of lines/expressions required to express ideas reduces the number of errors by the same factor. Brevity pays when readability isn't sacrificed.

Re: Forth: The programming language that writes itself

#127
post #18
post #3

Why is it that languages like this don't scale? It's not the first time I see a powerful language that got forgotten. Other examples include SmallTalk and Common Lisp (tiny community). It is because some languages are "too powerful"? What does that say about our industry? That we're still not that advanced of a specie to be able to handle the full power of such languages? I say that because it seems languages that ar…

I think those other languages have real advantages you aren't seeing. —·— The other day akkartik wrote an implementation of the program Knuth used to introduce literate programming to the CACM readers: https://basiclang.solarpunk.au/d/7-don-knuths-original-liter... It just tells you the top N words by frequency in its input (default N=100) with words of the same frequency ordered alphabetically and all words converte…

> You can do anything you want in it, it's super flexible, the tooling is great, but almost everything requires you to just write quite a bit more code than you would in Perl, Python, Ruby, JS, etc.

Given that Smalltalk precedes JS by many years: if it is true, then it was not always true.

Given that Smalltalk was early to the GUI WIMP party: if it is true, then it was not always true for GUI WIMP use.

Re: Forth: The programming language that writes itself

#128
post #32

Earlier quoted context omitted.

> As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical. I originally wrote GraFORTH ( https://archive.org/details/a2_GraFORTH_1981_Lutus_Paul ) to escape the slow world of integer BASIC on my first computer (an Apple II). Because it relied on large blocks of assembly code to produce nice graphics, it perhaps misled people about wha…

> I originally wrote GraFORTH Oh really? Given you were around at about the correct time period, could you hazard a guess at what dialect this very old Forth game from Byte magazine was written in? https://github.com/RickCarlino/Cosmic-Conquest-1982 It has some graphics commands in that I couldn't find in any other version of Forth on the Apple II. I'm a little outside the Apple II demographic, since they didn't real…

Yes, Paul Lutus wrote GraForth.

As for vhtab, I don't know.

https://groups.google.com/g/comp.lang.forth/c/WqrpoPtxwoM/m/...

A customized figforth 79forth proforth or some other forth lost in a basement.

Re: Forth: The programming language that writes itself

#129
post #69

"Working without names (also known as implicit or tacit or point-free programming) is sometimes a more natural and less irritating way to compute. Getting rid of names can also lead to much more concise code. And less code is good code." Does Forth really reduce the burden of naming things? You don't name results but don't you have to pay for it with the burden of naming words? (My impression is that there's more wor…

> Does Forth really reduce the burden of naming things?

I would say that you have less names, but they are more important. Plus, it is more difficult to name things because you prefer short names; in all languages, when you have a good naming "discipline", follow a naming convention, you end up with an informal "grammar" inside of your names. In Forth this is even more important.

> My impression is that there's more words in a Forth program than functions in an equivalent program in a language that has named variables

Yes, some people have called that "ravioli code" or "confetti code", IIRC. But most of them are support words. In Forth, you also eventually end up with "module APIs". This also exists in C or Java or ..., except the ratio useful:support is lower.

Post reply on HN