Live data from Hacker News

Spatial languages: Writing code in 2D

shukla.io

21–30 of 48 posts

Re: Spatial languages: Writing code in 2D

#21

> 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

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?

Re: Spatial languages: Writing code in 2D

#22

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…

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

Re: Spatial languages: Writing code in 2D

#24

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…

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.

Re: Spatial languages: Writing code in 2D

#26

Earlier quoted context omitted.

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…

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

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

Re: Spatial languages: Writing code in 2D

#27

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…

[deleted]

Re: Spatial languages: Writing code in 2D

#29

Earlier quoted context omitted.

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

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

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

Re: Spatial languages: Writing code in 2D

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

Post reply on HN