Live data from Hacker News

Thoughts on Forth Programming

call-with-current-continuation.org

71–80 of 97 posts

Re: Thoughts on Forth Programming

#71

Anyone who wants to see a modern forth with elements of common lisp that is focused on application development should check out Factor. Concatenative languages are really fun to use once you get over the initial hump. https://github.com/factor/factor

Factor is a good example of what the writer of the linked article considers:

>...what just ends up being some sort of Lisp with a funny notation.

Re: Thoughts on Forth Programming

#72

Earlier quoted context omitted.

FORTH has both an "inner interpreter" and an "outer interpreter" (aka the compiler, but that also works interactively like an interpreter). The inner interpreter is the thing that threads between words, and is typically an assembly function named "NEXT", which can be just a few instructions. Here is the FIG-FORTH 6502 implementation of "NEXT" (which is a bunch of instructions since the 6502 has 8 bit registers and si…

Here's a cool dynamic WebAssembly based Forth: https://el-tramo.be/blog/waforth/ >The Interpreter >The interpreter runs a loop that processes commands, and switches to and from compiler mode. >Contrary to some other Forth systems, WAForth doesn’t use direct threading for executing code, where generated code is interleaved with data, and the program jumps between these pieces of code. WebAssembly doesn’t allow unstruc…

Someone has done a port of PostScript (GhostScript) to WebAssembly:

https://chrome.google.com/webstore/detail/postscript-viewer/...

I wonder if NeWS, or something similar, could be resurrected in-browser?

Re: Thoughts on Forth Programming

#73
post #52

Forth style is great for writing but very hard for reading. I'm playing around with the idea that you use a Forth-like language to interactively develop code. The steps you perform become AST nodes. Then when you want to read it, it comes out in another form. This is more ideal because it is more interactive and you can see the immediate result every step of the way. This is different than writing traditional code be…

What I would like to have (and looks quite similar to what you are describing) is some APL interpreter (or J or K...) with an RPN input method. The idea comes from HP calculators, where you use RPN to "build" algebraic expressions.

I have many ideas for such a system, but it will require much experimentation to get it right and, at this moment, is just vaporware.

Re: Thoughts on Forth Programming

#74
post #3

Earlier quoted context omitted.

You define words which are like functions which you could use to operate on multibyte data. Most forth code uses large dictionaries of words. So it will look like 'dosomething decode bytes' where bytes is your utf8 and decode is some utf8 decoder and so on. edit: see https://rosettacode.org/wiki/UTF-8_encode_and_decode#Forth for a forth word for decoding utf-8

Looking at this Forth code as a programmer who has never written any Forth code, I can understand how "ordinary" code looks to non-programmers. That whole RPN business means I cannot even figure out where to start reading.

Take a look at the book Starting Forth:

https://www.forth.com/starting-forth/

Re: Thoughts on Forth Programming

#75
The classic problem with inventing your own language is that now you can't understand anyone else. If we're going to have widespread communication then we need widely-understood languages and libraries. The goal should be to replicate understanding. We need to evolve a common vocabulary rather than ending up with nearly as many private dialects as programmers. Publishing libraries and gaining users for them should be a primary goal.

There are Forth words with generally agreed-on definitions but it seems it's not designed to grow a large, common vocabulary in the way that modern package managers enable.

Re: Thoughts on Forth Programming

#76

The classic problem with inventing your own language is that now you can't understand anyone else. If we're going to have widespread communication then we need widely-understood languages and libraries. The goal should be to replicate understanding. We need to evolve a common vocabulary rather than ending up with nearly as many private dialects as programmers. Publishing libraries and gaining users for them should be…

The counterpoint is that every software project of reasonable complexity evolves its own language anyway.

When that is layered on top of overly generic libraries/frameworks, you may end up using only parts of the underlying vocabulary. Now the project is stuck with two vocabularies. Learning the generic one doesn't get you far and may be actively misleading ("yeah, we never use features X and Y of the framework, instead we've overridden Z with our own implementation that does all this plus W").

Re: Thoughts on Forth Programming

#77
post #36

Can you please give some examples on those who are extremely productive using FORTH? I'm intrigued. I think FORTH could be very useful to someone who prefers to work alone or in small group, but I'm not sure how do they use it in daily life.

Mitch Bradley. He wrote the firmware for Sun machines, made an IEEE standard of it, open sourced it for OLPC. Highly productive guy. Interview with him seems to have disappeared from the web? http://mitchbradley.blogspot.com/2010/08/open-firmware-and-o...

Thanks buddy, this (including the long replies in the same thread) is really interesting. Although myself is not a programmer, it looks very interesting, at least conceptually.

Re: Thoughts on Forth Programming

#78
post #76

The classic problem with inventing your own language is that now you can't understand anyone else. If we're going to have widespread communication then we need widely-understood languages and libraries. The goal should be to replicate understanding. We need to evolve a common vocabulary rather than ending up with nearly as many private dialects as programmers. Publishing libraries and gaining users for them should be…

The counterpoint is that every software project of reasonable complexity evolves its own language anyway. When that is layered on top of overly generic libraries/frameworks, you may end up using only parts of the underlying vocabulary. Now the project is stuck with two vocabularies. Learning the generic one doesn't get you far and may be actively misleading ("yeah, we never use features X and Y of the framework, inst…

I'm also for a common vocabulary, but I wonder why you're getting downvoated for having another opinion.

Re: Thoughts on Forth Programming

#79

The classic problem with inventing your own language is that now you can't understand anyone else. If we're going to have widespread communication then we need widely-understood languages and libraries. The goal should be to replicate understanding. We need to evolve a common vocabulary rather than ending up with nearly as many private dialects as programmers. Publishing libraries and gaining users for them should be…

> Forth is quite "invidualistic", tailored to single persons or small groups of programmers, mostly because it is natural and relatively straightforward to implement a Forth system yourself (and you should) and because the language is inherently malleable and adapts to your needs. Therefore what I write is just one way of seeing Forth, which is both a programming language and a engineering philosophy.

Sometimes... you don't need to understand anyone else, or to be understood by anyone else. Sometimes you just want to do what you need to do.

The goal of replicating understanding is all well and good, but that shouldn't be the primary goal of programming language development, nor should it be the primary goal of programming.

I don't think that anyone is suggesting that we start rebuilding enterprise service frameworks in Forth.

Re: Thoughts on Forth Programming

#80
post #76

The classic problem with inventing your own language is that now you can't understand anyone else. If we're going to have widespread communication then we need widely-understood languages and libraries. The goal should be to replicate understanding. We need to evolve a common vocabulary rather than ending up with nearly as many private dialects as programmers. Publishing libraries and gaining users for them should be…

The counterpoint is that every software project of reasonable complexity evolves its own language anyway. When that is layered on top of overly generic libraries/frameworks, you may end up using only parts of the underlying vocabulary. Now the project is stuck with two vocabularies. Learning the generic one doesn't get you far and may be actively misleading ("yeah, we never use features X and Y of the framework, inst…

Yes, that's a problem with code sharing gone wrong. Another problem is framework churn where popular libraries aren't stable. When good, stable libraries aren't available then it may be better to reimplement than to use a bad one.

But these problems are, in their way, a sign of success at the package management level. If you don't have good package management then people probably aren't having much success at sharing code.

We should still aim for building and sharing stable, well-understood, high-quality code libraries. Unfortunately, sometimes the way to get there is to go through a period of instability.

Post reply on HN