121 points · by BinRoo · 4mo ago · 46 comments
Text is a serialization of an n-dimensional work space. "N-dimensional" doesn't have a formal definition I'm aware of but the major characteristic of it is that a new dimension can pop up anywhere. If you feel like you want to double-click on that, you can see my earlier comment here: https://news.ycombinator.com/item?id=35096647
A conventional textual language can represent everything mentioned there, whereas 2D layouts struggle almost immediately to represent things that textual layouts represent quite easily.
It can still be a useful "see the world differently" exercise, but it's the opposite of "freeing your mind"... it's stepping into a fairly small subset of functionality, albeit an unconventional one, and seeing what you can still manage to do even so. Rather than "unlocking a new dimension" it's actually throwing away n-2 of them. The experience of using this for any period of time would reveal this, as it would be a constant struggle to represent even very simple algorithms in this format.
I post this mostly because of the "familiarity breeds contempt" effect that programmers seem to get hit with for text. There is a reason we use text and it's not lack of imagination or being stuck in our ways... it is actually an incredibly rich and powerful format that poses a serious challenge for any alternative to overcome because of the astonishing combination of compactness combined with representational power.
Text works and is hard because it's a projection of a mental representation. The whole reason we can work with N-dimensional structures in text is because the dimensionality lives in the programmer's head. There isn't really any other way to represent say a >3 dimensional array other than laboriously flattening it into text and expecting the next guy to rotate the hypercube in his mind. That's neither a good nor bad thing, it's purely a fact of our 3+1 dimensional universe.
A shocking number of problems can be best represented in higher dimensions and there's simply no way to encode that information losslessly. Being simple 3D creatures (I'd argue 2D in fact) the only way to do that is by projecting it down into a lower-dimensional space.
Anyone that says text is 1D has a poor model of code in his or her mind.
It's surprising that there is any art at all if 1D textual representation is the ultimate way of representing concepts of the world around us. Incredible really that folks waste their time define colours for such thing as the sunshine.
Oh sorry, of course, you were talking of code - meaning that algorithm concepts are best represented in text? Again, I doubt that very much. Laziness of humans is probably the bigger reason why we're stuck with an inefficient textual representation of higher dimensional concepts.
Notably the mental model of the hardware is different for each case. Other species of languages like Lisps and Golang and SIMD fascinate me because computer hardware fascinates me.
I like the toy 2D textual experiment the author has given us, and I agree with you it would not scale. Since the author calls their toy 'goofy' they probably agree. But I would contest (edit: your point that we are not stuck in our ways.) We are by and large seriously stuck in our ways. Even if a perfect visual/spatial programming language dropped into our laps today, I posit it would take over 50 years to meaningfully supplant C et al..
Visual programming, another ever-recurring supposed replacement for text that is just obviously so much better and programmers are just stupid for sticking to plain and boring text, has a similar problem, where in return for whatever visual organization it makes possible (but does not force, since you can still make stupid visual programs) it is countered by the annoyance of suddenly having so many more constraints on the program, like, having to worry about layout, and how the lines cross each other, and whether some part of the program is literally overlapping another, and how all these concerns tend to grow as O(n^2) on the number of elements if not confined somehow. This one has led to some modest success in certain limited environments, but as a replacement for textual programming it fundamentally flounders on the fact that its additional constraints creates problems significantly faster than it can solve problems.
>What does an algorithm look like?
and aside from traditional flowcharts, this isn't much agreement on an answer.
For visual programming, it tends to devolve to spaghetti:
Hypertools[0] used to display a 'standard program' mapped to '4d' esolang piet might be interesting. A window of 'text breakout of piet segment' relevant to 'standard programming line' would be sorta like mapping set of assembler to corresponding source code line.
piet whylines : https://www.cs.cmu.edu/~NatProg/whyline.html
[0] : hypertools : https://news.ycombinator.com/item?id=31816024
I had difficulty reading large blocks of text when younger partly dyslexia I found out about much later, but mostly just overwhelming to look at. Then I learnt how to think of code as checkpoints, paths and basically a 2d map in a sense.
It helped me get used to huge walls of text. Maybe since we now have AI we can do some fun stuff in this direction since human ergonomics for writing code matter less than making code fun to read so that we can read and validate massive AI code.
Would be a fun experiment now that I think about it, I guess I found what I am doing tomorrow.
Nitpick - the andFlip function is wasting a whole dimension with unnecessary lines, and also modifying its input argument unnecessarily (yuck!), and it takes 3 arguments as an array for no good reason.
Better: andFlip = lambda a,b,c : not c if (a and b) else c
Except this is really just a normal 2 argument ternary, it does nothing interesting with a or b individually, it treats them as a unit, so I’d argue this shouldn’t even be a function.
It is used to compose songs. You can see the demo in the linked page.
I've got my 3D glyph rendering system at glyph3d.dev, and use cases like this help accelerate layout and relationship development immensely. I greatly appreciate your sharing this!
Would you happen to have a trove of similar research or papers I could sponge off of you? Or maybe even a few minutes of your time in some chats / emails to discuss how these tools can be brought to a modern runtime?
(vs. more traditioinal abstraction/logic level planes & normal to plane concepts: apl - hide it all in the language; spreadsheet - hide nothing/any information at any abstraction level is displayable[2][3][4][5]6])
--------------------------------------------------------------------------------
[1] Unicode bidirectinal algorithm : https://www.unicode.org/reports/tr9/
[2] spreadsheet : http://en.wikipedia.org/wiki/Spreadsheet
[3] sc-im - an ncuses spreadsheet program for the terminal: https://news.ycombinator.com/item?id=24318367
[4] Excel as a Turing-complete functional programming environment : https://eusprig.org/wp-content/uploads/2309.00115.pdf
[5] lambda the ultimate excell worksheet function : https://www.microsoft.com/en-us/research/blog/lambda-the-ult...
[6] escher circuits : https://esoteric.codes/blog/escher-circuits-using-vision-to-...
I just started note taking by hand and I find it way more enjoyable than typing. So maybe it’s a medium to force myself to code like in the old days.
I was looking for something like spatial computing and all I could find were esolangs, UML, and maybe punchcards? This gives me an idea on how this could be useful.
One can use intensional calculus concepts to model non-lambda languages[3]. A live 'CoC'[6] / rocq[7] layer to hightlight/note 'correctness' issues (auotmated suggestion of proof of correctness/unresolved ANTLER freevars take on ast editors 'valid' language statement(s)/language block(s))
ast editor with gui nodes (panograph[1]) / code block with "user shape" construction using 3DILG[2]?
3d bar codes could be taken as a 'multi-statement' token.
Piet[4][5] programming language might be more useful than 3d barcode as langauge token though (condensed spreadsheet).
-----------------------------------------------------
[0] : https://www.media.mit.edu/projects/2d-an-exploration-of-draw...
[1] : https://github.com/jeprinz/pantograph/blob/main/README.md
[2] : https://1zb.github.io/3DILG/
[3] : [video] Beyond Lambda-Calculus: Intensional Computation calculus : https://news.ycombinator.com/item?id=49067361
[4] : piet examples : https://www.dangermouse.net/esoteric/piet/samples.html
[5] : esolang Piet : https://esolangs.org/wiki/Piet
[6] : calculus of constructions : https://en.wikipedia.org/wiki/Calculus_of_constructions
[7] : rocq : https://en.wikipedia.org/wiki/Rocq
Would a better example be Python's inline if else construction?
x = 3 if thing else 4What I was looking for was actually "Piet":
The great gift of language is that it allows us to talk about arbitrarily complex things using a stream-like medium. Human speech is fundamentally 1D. The tree like structure of the concepts in language then facilitates the exponential growth in complexity.
Or maybe centuries of human progress just went completely in the wrong direction? Unlikely.
Nothing wrong with being silly, of course.
Or, you stick to oldschool old people. Keep things simple.
As a 2D representation, I've been using flow based programming (FBP)[1] and it's incarnation in Node-RED[2]. The trick here is to understand how to use FBP to create more generalistic programs, i.e., to prove it's Turing Complete.
I think it would be a mistake to just start out with a 2D approach without also taking all the learnings we have made in 1D, i.e. TDD, OOP, KISS, DRY, Functional, Message Passing, Processes etc, and porting those to a 2D representation.
[1]: https://jpaulm.github.io/fbp/
[2]: https://nodered.org/
I think this is because I reason about programs being in some state ~= being positioned at a certain function with some context I carry around. I'm sure it's not the only way to think about it, but it's a reasonable abstraction over what computers do. It's how we oriented our debuggers and early IDEs on as well, and carried this over to modern tools.
Definitely something I'll be thinking about during the next few days.