Tylr: A tiny tile-based editor
tylr.fun
tylr.fun
It was like "programming languages and workflows are built around the state of having written code rather than writing code." I think the example was how in most languages you can remove a few chars or a symbol and put it in a 100% invalid state where none of the tools will work at all. A few seconds ago you had a bunch of type information, jump-to-definition, auto formatting etc, now you have a compiler error instead.
It really stuck with me because it described an experience so common I don't even really notice it anymore but really. What would it be like to work in a language that considered "non-functional" states still "valid" and tried to express what they knew about the gaps?
This is a very different idea but I feel like it's approaching some of the same concepts, in a way.
Limiting deltas to working-only states would, I think, result in something akin to MIT's 'Scratch' language, where kids put together puzzle pieces - a program can only be wrong at a semantic level, never at a source code level. OTOH, refactoring power tools available in modern IDEs are a bit of a counter-argument in that they allow code transforms that don't usually make much of a semantic difference (eg. 'inline this', 'extract this as a variable', etc) But as you say, that's "written code" not "writing code".
For writing code, I think the closest current IDE feature to tylr would maybe be syntax hilighting. It'd be cool to maybe have some kind of 'expression hilighting' mode, and maybe an 'expression editor' mode with actions like tylr supports.
However, I think that's a good thing. The alternative to partially typing out functions would be selecting them from a list or automatically having the editor fill in the most likely match from before the first letter is typed.
Both the latter would, if interrupted, convey less information than the partially typed out name.
Phrased differently: writing code will always be a matter of narrowing down the full namespace to the appropriate function. Partially typing it provides the human about the most information on where things are going, even if it's not as friendly on compilers.
So yeah, we could have compilers fill in the missing information to create a compiler-valid state from partial information, but what does that give us? A wildly incorrect program that's harder to fix?
Programming is writing code for humans that computers occasionally read, not the other way around. With today's focus on tooling, I feel like we have forgotten this.
The closest I can think of is HTML, where browsers try their best to resolve small syntax errors. I suspect this is easier to accomplish with markup than with most programming languages.
Of course, ambiguous syntax will obscure any information beyond what can be understood (short of having a compiler track changes between runs).
Some languages / compilers can recover after a parse error. Going back to the ts language server, if you introduce a single quote, unclosed, nothing works until the end of the line (single quoted strings cannot be multiline)
Both before the quote and after that line, however, features such as auto-importing and autocompletion still work as expected.
This is an issue of where the boundaries of the ambiguity lie (what is possible) and the implementation (what actually happens). I suspect many language / compiler / IDE tools fall in different places on the spectrum of possible and works to possible but not implemented. My hunch is that more and more, tools are getting closer to the "possible and works" side of things.
That is, if you're observing from life, you might have some lines to broadly structure the image first: some angles and lengths, a grid, or an envelope shape. Then to develop connectedness and flow you might switch to drawing in sweeping gestures. Then you might switch again to 3D construction to refine the forms and make them align well, and finish by adding shading lines to render the lighting and details.
Gestural lines are powerful because they generate lots of proportional information: a straight line tells us a single angle and length, while a sweeping curve can be nearly infinite.
Right now when we type code, it's a little more like poking at the drawing, making little scribble lines everywhere. We don't have gestural lines, and the structural tools are also limited - we often have to erase and redo things because the "proportions" are off.
While I don't know if the literal translation of this to "programming with a stylus" would work out, it's definitely on my mind now.
[1] https://www.jetbrains.com/mps/
[2] https://jaredforsyth.com/posts/whats-cool-about-unison/#Code...
Was modifying the AST part of the GUI explicitly?
In Algol-descended languages like C, Java etc, the expression tree can look quite structurally different from the program due to precedence rules etc.
I think a tree-style editor for a more conventional PL would have to apply some transformations on the AST for display purposes, for programmer comfort.
[1] https://liveprog.org/live-2021/Restructuring-Structure-Editi...
Unfortunately I don't understand the language. But man, the UI looks and feels great.
ETA: More relared work at Michigan apparently goes by the name Hazel[1]. There was a recorded talk[2] at LIVE 2021. The textual version has been removed[3] from the repo for some reason(?) but remains on the website[4]. The authors suggest the relevant class of languages is “visibly pushdown”[5].
Also looks like a match made in heaven for an Explain Shell[6]-alike.
[1] https://hazel.org/, https://web.eecs.umich.edu/~comar/
[2] https://2021.splashcon.org/details/live-2021-papers/4/Restru..., https://liveprog.org/live-2021/Restructuring-Structure-Editi...
[3] https://github.com/hazelgrove/tylr/commit/1db7a2b2a2ed263183...
[5] https://www.csa.iisc.ac.in/~deepakd/atc-common/vpa-stoc04.pd...
[6] https://explainshell.com/, https://news.ycombinator.com/item?id=6296634