Live data from Hacker News

Spatial languages: Writing code in 2D

shukla.io

31–40 of 48 posts

Re: Spatial languages: Writing code in 2D

#31
Isn't all code 2d, what comes above and what's below matters in code, it isn't even necessarily a straight line, gotos are like teleportation or fast travel points, recursion is pretty interesting.

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.

Re: Spatial languages: Writing code in 2D

#32

Earlier quoted context omitted.

You're saying that text are 1D, while we're saying that it's not. If it were, we would write text on a long rolling tape. If it were, we would write matrices like this: [1 2 3; 4 5 6; 7 8 9] Instead of |1 2 3| |4 5 6| |7 8 9| The concept of vertical space to separate blocks of text is important. The concept of physically moving the next chapter to a separate sheets of paper in books is equally important. In code we s…

Sure, I can use ascii graphics to represent 2D shapes in text but that's not a direct representation of the original object: \ | / .-'-. -- ( ) -- `-.-' / | \ That's a sun. Much like HN is full of textual description and links to images - this entire forum demonstrates the limitations of a textual visual representation. Yes it works but it's far more verbose than an image would be. Hence an image is worth a 1000 word…

"Yes it works but it's far more verbose than an image would be. "

The word "sun" is less verbose than your drawing, but more clear(I would not have recognized it as a sun) and has all the information implied.

Re: Spatial languages: Writing code in 2D

#33
post #5

"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.ycombinat…

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

Re: Spatial languages: Writing code in 2D

#36
post #5

"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.ycombinat…

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.

Re: Spatial languages: Writing code in 2D

#37

Earlier quoted context omitted.

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 say…

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 r…

See: https://news.ycombinator.com/item?id=49051595

Of course, if you're sure that the entire rest of the industry is just lazy, then by all means feel free to join the set of people who have spent vast amounts of time trying to prove out these obviously better ideas. You've got AI now, I'm sure that will make it easier to prove it out. I imagine it can bang together a visual programming language nowadays in a few prompts whereas earlier generations actually had to rather laboriously put one together. You can get right to the part where you actually get to play with the ideas and try to make it fix programming in probably 1% of the time as the efforts that have periodically made HN's front page.

My standard challenge[1] is to make a visual quicksort algorithm that people will generally agree is nicer to read than a textual representation, where the textual representation may include comments (though so can the visual replacement). It's chosen to still not be fundamentally impossible, but to get past the sorts of "look, I can interate on a list and increment each value" demos they tend to come with.

[1]: https://news.ycombinator.com/item?id=25332761

Re: Spatial languages: Writing code in 2D

#38
post #5

"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.ycombinat…

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

Re: Spatial languages: Writing code in 2D

#39

Earlier quoted context omitted.

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 r…

You're saying that text are 1D, while we're saying that it's not. If it were, we would write text on a long rolling tape. If it were, we would write matrices like this: [1 2 3; 4 5 6; 7 8 9] Instead of |1 2 3| |4 5 6| |7 8 9| The concept of vertical space to separate blocks of text is important. The concept of physically moving the next chapter to a separate sheets of paper in books is equally important. In code we s…

A matrix is better represented as a nested list of lists:

   ((1 2 3)(4 5 6)(6 7 8))
Of course you ignore that representing a tensor of rank higher than 2 is just as difficult in 2d as a matrix is in 1d.

Re: Spatial languages: Writing code in 2D

#40
post #36

Earlier quoted context omitted.

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…

The fundamental question is:

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

https://blueprintsfromhell.tumblr.com/

https://scriptsofanotherdimension.tumblr.com/

Post reply on HN