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

  • vitally3643 4 hours ago

    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.

    • skydhash 4 hours ago

      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.

      • Towaway69 4 hours ago

        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.

        • skydhash 4 hours ago

          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 split the code into files. Then within the files we arrange the code with lines and indentation. That's all for humans. The computer eagerly throws those away.

          ADDENDUM

          > meaning that algorithm concepts are best represented in text? Again, I doubt that very much.

          One of the (most?) important things that algorithms encode is time. Because an algorithm is a description of a process. The only good representation would have been to snapshot the evolution of state.

          But that's wasteful. So instead we have statements and expressions that we assume are atomic. Then we have identifiers for referencing and finally we have procedures and functions to cluster those statements and the associated call/return pattern or the single jump/goto to economize on writing.

          So code is at least 2D as operations are described in a line and the lines are arranged by time. But the lines are not linear, instead they are grouped into labelled units and the proper evolution are functions call and jump instructions.

          • Towaway69 3 hours ago

            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 words. And hence HN is more verbose than it needs to be. So is coding more verbose than it needs to be. That's why DSLs (Domain Specific Language) get invented: to reduce the verbosity.

            And so it is with a 2D representation: it reduces the verbosity required to transport ideas and concepts. UML is another invention to reduce the verbosity and increase the understanding of the representation of complex systems. Yes UML can be represented as text (see Mermaid[1]) but the UML image is probably a lot more understandable than the Mermaid representation.

            [1]: https://github.com/mermaid-js/mermaid

            • lukan an hour ago

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

            • skydhash 2 hours ago

              An image is not a good representation either. Where is heat? Where is size? Where is gravity? Images are useful, but so is text, each in a different way. The nice thing about text is that it encodes a much larger representation of something in only a few. So I can type 'sun' and it's useful enough to get my meaning without me showing you a picture every once in a while.

              So yes in certain context, a diagram may be more useful to get a point across. But once that shared understanding has taken place, Text are more economical.

              A lot of foundational aspects of computing are too abstract in nature to be able to do a good 2D or 3D representation. So what we do is transforming them into streams of symbols and do symbolic manipulations on them. And with symbolic manipulation, you get abstraction.

              The main issue is that a lot of people are not good at symbolic representation and manipulation. Because it's abstract and it's entirely a product of the mind.

              The power of computers is that they can do the tedious part of symbolic manipulations, repeatedly and without failing. And with peripherals interfacing, they can translate symbols from/to reality.

              • Towaway69 2 hours ago

                > The power of computers is that they can do the tedious part of symbolic manipulations, repeatedly and without failing. And with peripherals interfacing, they can translate symbols from/to reality.

                Exactly what I am implying: using the computer to provide a better abstraction is what is needed.

                I agree that text has a certain universality however as you also say, a lot folks don't work with symbols, they work with images (for example) or colours (synesthesia) or shapes perhaps.

                Besides move up in dimensions is a continuation of a natural progression in computing: cogs, switchs, punch cards, keyboards, mouse, touch .... VR, AR etc. Currently we're (coders) are somewhere between keyboard and mouse while others (most folks that use smart phones) are at touch. Smart phones users are also programmers who code their device using largely visual concepts (at least I've not seen anyone set their alarm using a terminal on a smart phone!).

                Now "Oh but it's not possible to represent those concepts that we work with visually, only text will do" argument doesn't really hold water since it just demonstrates a lack of imagination to find a way to use other representations for those concepts that are essential to programming. Strangely that was possible when moving from switches to keyboards, why shouldn't it be possible even further.

                Recently I had the thought that in fact, textual programming (as a paradigm) is now the sole domain of AIs. I've heard so many coders say they have not coded a line of code in months/years, AI is doing all the coding for them. Hence, I think, we humans (those of us here who are humans) should step up to the next domain for coding: 2D and then 3D and explore improved abstractions for the concepts we try to represent in a textual manner (even these concepts are abstractions of the real world).

                • skydhash an hour ago

                  > Now "Oh but it's not possible to represent those concepts that we work with visually, only text will do" argument doesn't really hold water since it just demonstrates a lack of imagination to find a way to use other representations for those concepts that are essential to programming

                  I did not say that. I said that we do not have good representations of those concepts.

                  The thing is that programming is rarely the end goal of things. It's merely the help. There's often an actual task or process that existed before we got to the programming itself. The goal is to automate some subset or all of it using computers. And programming is about constructing a model of the task/process, encode the state and the rules that govern the evolution of the state, and then interfacing with the real world to get data (sensors), manipulate them according, and then produce actions (with actuators).

                  Text is universal because it's symbolic (and with it come abstraction which is recursive in that form). And we managed to get a good representation of time (which is also a key part of the task/process) with vertical alignment. And we can implement extra dimensions that matters to comprehension with modularization and whats not. The cons are that symbol manipulation can be abstract and requires a good deal of training to transfer that knowledge.

                  The issue with most 2D representation is that they're not flexible enough. Symbols are recursive. Meaning to encode more things, you just needs to repeat symbols. And then you can use symbols to encode group of symbols. Like we have 1 and 0 as the base of everything, then we encoded the alphabet using ASCII, then we encoded programming concepts using tokens (group of letters and other special symbols) and grammar, then we goes one to define higher other of things like variable definition, functions, types annotation, which just more syntax and grammar rules.

                  > Besides move up in dimensions is a continuation of a natural progression in computing: cogs, switchs, punch cards, keyboards, mouse, touch .... VR, AR

                  That's an evolution in interfacing. And the one thing about interfacing is that it has to adapt to the physical reality of human interactions. Which is often not great for the actual reality of the tasks/process that needs to happen. In the physical world, it's often physical laws and causal order that does all the work, we are only the perturbation force. We move the steering wheel and the car turns, but that's mostly due to mechanical laws than the actual act of turning the wheel.

                  With programming, the task is often to recreate all the laws that govern the evolution of a process and then offers an interface for controlling that evolution. 2D and 3D diagrams are very bad at describing ALL the relations between the different components of a system. Let's take the "F = ma" equation: How would you represent the force, mass, and acceleration concepts in order to create like a very simple physic engine? We can create a special interface for that, but that interface would be likely bad for creating a bookkeeping software or a text editors.

                  Symbolic representation is universal because there's only two things that matters, the symbols and the rules of notation. And the genius of the Turing Machine (and equivalent) is that at the foundation of things, you do not need a lot of symbols and a lot of rules. You can go from one system to the next by creating a translation mechanism. But if you leave the symbolic world, you lose universality for power. That's happen with GUI software and other 2D and 3D representation of things. Which is why you see that professional software have a scripting layer or a plugin mechanism.

  • DoubleDecoded 4 hours ago

    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.

minraws an hour ago

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.

DanielVZ an hour ago

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.

dahart 4 hours ago

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.

cavoirom 3 days ago

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.

  • atoav 5 hours ago

    It is mentioned at the bottom of the page, but yeah Orca ia pretty good.

robertlagrant an hour ago

> 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
intrstng-stff 4 hours ago

> 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

  • tikimcfee 3 hours ago

    I didn't know this paper existed and I'm excited to devour this.

    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?

glouwbug 3 hours ago

Anyone here ever use labview?

  • rogerdickey 2 hours ago

    Yeah. Love it! Used to make games with it, even

zellyn 4 hours ago

I find it endlessly fun that one of the best environments for playing with befunge is written for the zmachine.

BinRoo 3 days ago

I ventured out to better read Qiskit code, and came back with this fun idea of 2D expressions

levzettelin 4 hours ago

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.

shevy-java 5 hours ago

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.

  • Towaway69 4 hours ago

    My approach is to start out with a 2D programming environment and once that becomes a general programming environment, to scale that up to 3D and explore how to map 2D to 3D. So first map 1D concepts to 2D and then move on.

    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/

  • ivanjermakov 5 hours ago

    I think humans are pretty good at thinking/operating in a 3D space. It's just that digital interface and programming tooling is not there. Obviously because usually there is no direct translation from domain model to physical 3D shapes. But it can well for those that translate: 3D modelling, spatial reasoning, motion tracking, mechanics, etc.

    • xpct 5 hours ago

      I imagine this varies by person, but thinking about a source file is already reminiscent of 2D space navigation, where the X axis is typically gated by conditions. In a similar vein, when I think about functions from different source files, I do hold some type of "depth", or "stacked panels" in my brain.

      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.

      • ivanjermakov 4 hours ago

        For real! Good contenders for 3 dimensions: individual expressions, call stack, time.