23 comments

[ 0.21 ms ] story [ 44.8 ms ] thread
I ventured out to better read Qiskit code, and came back with this fun idea of 2D expressions
in the same spirit, checkout Orca: https://100r.co/site/orca.html

It is used to compose songs. You can see the demo in the linked page.

It is mentioned at the bottom of the page, but yeah Orca ia pretty good.
Soon we have an IDE that works in 3D. So, not only do you have to look left-right, then top-bottom, but also before, and behind. That's scaling code! You write in 3D now.

Or, you stick to oldschool old people. Keep things simple.

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

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.
This is cute, and it’s fine and fun to play around, but I don’t know, takes itself way too seriously or something. I apologize for being negative, but blowing my mind? No, not exactly. The attempt at the end to justify isn’t compelling to me and feels pretentious or something; the so-called Sapir-Whorf hypothesis (a misnomer according to the link) is about words and concepts, not about layout. This article fails to consider how to say or to read 2D code, or even think about why text is normally 1D. Language is expressed in one dimension because of time. We don’t speak in 2D, because we can’t, therefore we don’t write in 2D. We do visualize parse trees as trees (2D pictures) all the time, which isn’t mentioned. Also not mentioned are all the massive downsides of trying to write & edit & maintain 2D code, as well as the fact that we have good ways to write 3+ argument functions in 1D.

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.

This is just silly.

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.

I find it endlessly fun that one of the best environments for playing with befunge is written for the zmachine.
> Cube is a three-dimensional, visual, statically typed, higher-order logic programming language, designed to be used in a virtual-reality-based programming environment. In this paper, we give an informal overview of the language and describe a prototype implementation.

https://marc.najork.org/papers/jvlc1996.pdf

Anyone here ever use labview?
> We don’t really see 3-arity functions written in infix notation much.

Would a better example be Python's inline if else construction?

  x = 3 if thing else 4
I was recently spending the last few days pondering how I would program in pen and paper if there were no technical restrictions other than having to define the program.

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.

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.

thats really, really cool, but is this implementable, for showcasing its good but what about practical? btw w
Turing Tumble is pretty fun.
A use case for unicode bidirectional algorithm[1] at language implimentation level.

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

λ-2D: An Exploration of Drawing as Programming Language, Featuring Ideas from Lambda Calculus [0]

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