Spatial languages: Writing code in 2D
86 points - last Wednesday at 2:03 PM
SourceComments
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.
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.
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.
It is used to compose songs. You can see the demo in the linked page.
Would a better example be Python's inline if else construction?
x = 3 if thing else 4The 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.