💾 Archived View for stack.tilde.cafe › gemlog › 2023-06-27.2dconcat.gmi captured on 2024-05-10 at 11:01:46. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-08)
-=-=-=-=-=-=-
gemini://taoetc.org/interleaved_2d_notation_for_concatenative_programming/index.gmi
I am always curious about structure editors, and ways to represent structured data, especially code. So I was pretty curious about this post and the provided links to the pdf file and a web IDE. However, I think this is one is totally pointless (like most attempts at 2d/graphical programming paradigms).
The beauty of concatenative languages such as Forth is that the arguments precede the operation dynamically/temporally, and can therefore be decoupled. Arguments can come from anywhere as long as they get pushed onto the stack -- at any time prior to the execution of this particular instruction! This is crucial, as that is how we concatenate.
This particular notation seems to require that all the arguments (or operations that generate arguments) to be stuck directly above the operation, lexically. This is really a form of parenthesizing - it provides boundaries within which the parameter list exists. This is pretty much Lisp - just move the parameters forward of the operation and parenthesize the entire thing.
Not having this kind of rigid structure is what makes concatenative languages fun. Consider the + word - it expects 2 things on the stack to add, but the two things do not have to explicitly precede the +. You can say '1 +' and this expression increments the top of the stack. How would you represent it in this 2d notation? You have to have two things above the +... so you need some extra syntax for the 'top-of-stack'. What if you want to call a function with a variable number of parameters? Concatenative languages can do that. What if you call a function that returns several parameters? Does it take up several spaces or one wide space? Bah.
In Forth you can take it a step further, and the _compiler_, while compiling, can use the stack, injecting data into the compiled code. How would you represent that in 2d?
So my question is: why? It's infinitely more convenient to write out Forth as extremely concise one-line definitions, instead of a screenload of weirdly spaced junk that looks like scratch or PLC. If you spend any amount of time actually writing code instead of coming up with fun ideas for an academic paper, you know that this is just foolishness, and you want to type out your code in the editor of your choice.
Every year someone makes an effort like this to replace a perfectly working notation with something that is much more limited and much less usable. Usually it's some noob Lisper trying to get rid of 'those annoying parentheses', not realizing that they are the best part of Lisp! The beauty of Forth, likewise, is a complete lack of syntax; introducing 'positional syntax' is a complete waste of time.