Comment by jerf

7 hours ago

"All this time we’ve been writing expressions in 1D space, but what happens when we unlock an extra dimension?"

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.

A certain subset of programmers apparently just really, really hate this whole messy concept of "thinking about things".

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.

  • And also we treat text as an higher dimensional concepts, like the concept of lines and indentations. Jumping around in code navigation, the tree structure in code organization. The separation of mutable semantics for the code in our projects and immutable ones in the libraries that are added. And that’s without diving into the abstraction represented by the symbols and the relationships between them.

    Anyone that says text is 1D has a poor model of code in his or her mind.

    • So the textual representation of the Mona Lisa would actually be more suitable and beautiful?

      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.

      9 replies →

I maintain some FPGA code in VHDL and also some C code for microcontroller. One thing I appreciate immensely about VHDL is how strict it is. You have no option but to think carefully about modularity and heirarchy. By comparison C is very free and simply offers the opportunity to make your own constraints.

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..

Code is natively tree like and hyperbolic. We unfortunately can't embed a 2d hyperbolic space on a computer screen.

1D languages encode these relations grammatically. There is no reason why a 2D language couldn't also be grammatical. Sure it is harder to write a 2D parser perhaps, but people have still played with the idea a little bit. There is just no huge economic incentive to do so other than simple aesthetics.

  • The problem with a "2D" text is that you think in your head that there's all these amazing possibilities that you're creating, when in fact you're taking on vastly more constraints. For a sort of simple analog to that, observe the number and nature of the Platonic Solids in various dimensions, and observe that despite the fact that the increasing number of dimensions might strike you as making it obvious that higher dimensions should have more and more Platonic solids, the number of constraints increases faster than the degrees of freedom do, and instead you get the same degenerate set of solids in 5+ dimensions, forever.

    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.