"Beautiful code: typography and visual programming" talk by Peter Hilton

See: https://www.youtube.com/watch?v=7vPh-xy-kyc

Maybe people will be using Mogan, TeXmacs, or a Mogan/TeXmacs widget in their IDE for computer programming in the near future…

3 Likes

Interesting talk. I didn’t know about the Fira Code font. I really love the ligatures! It seems they are not automatically supported in TeXmacs, though.

I also think that a type of visual coding could be implemented in TeXmacs. One could define tags that represent elements of code (such as a function definition or an if statement etc.), provide a package to style them nicely, and a converter to parse those tags into, say, Python code.

If I understood what you mean, I have a tiny bit of experience with visual coding using LabView and find it indigestible, an inextricable tangle of wires.

Syntax directed editors for source code have been tried several times and failed. So maybe the editing should not be structured but the source could be made to look beautiful anyway with a lot of magic happening behind the scenes.

As the video points out, Scratch is hugely popular with children. Do you have any examples to point to and reasons why they failed?

That’s not the type of visual programming I was thinking of, more something like an advanced Scratch.

2 Likes

From https://en.wikipedia.org/wiki/Structure_editor :

“Structure editing features in source code editors make it harder to write programs with invalid syntax. Language-sensitive editors may impose syntactic correctness as an absolute requirement (e.g., as did Mentor[2]), or may tolerate syntax errors after issuing a warning (e.g., as did the Cornell Program Synthesizer[3]). Strict structured editors often make it difficult to perform edits that are easy to perform with plain text editors, which is one of the factors contributing to the lack of adoption of structured editing in some domains, such as source code editing.”

Unfortunately, it doesn’t say what types of edits are meant.

Still, TeXmacs already is a structured editor and has many tools to perform operations on trees, such as a gui for performing structured search and replace, with wildcards.

But still, I think it is important to keep in mind that this is not a tool everyone needs. As the speaker in the video mentioned, there are many more types of coders now than there were twenty or even ten years ago. Many starting coders will not have a clue about what a regular expression is and would get much more advantage out of being prevented from writing incorrect code or from a clear graphical layout.

I like your attempt, but I wonder if using keybindings is the right approach, seem overkill, especially because does not distinguish function from "function", for example. I would maybe try to use macros like \if, \return, etc… to define a structured program. I think have an editor which enforces the structure of a program, like TeXmacs, is more important than have a constant visual feedback for it. It could just be that when you are in a block of code, it highlights all the parent blocks, etc… As Joris remark in the section of the manual dedicated to macro, having a nice visual rendering of a structured code is quite tricky. I like the approach he used in the macro language where there are hints to the rendered on what is the more appropriate way to render a block, i.e horizontal or vertical. I think similar hints could be used for standard code, and made to be ignored by the compiler/interpreter. In this direction one would go towards weave/tangle of Knuth, where the same document contains both informations for the human reader and informations for the compiler to correctly interpret the program.

1 Like

Guys can someone tell me how to work out factorisation without using any calculator or without getting help from Factors calculator with steps

Fantastic!

That’s what Mogan Code will be!

I will create a Structured Code Editor called Mogan Code first in the next follow years. And then I will create a Structured Programming Language called Mogan Language (maybe 10 years later).

1 Like

Discovered this via the TeXmacs Mastodon feed:
https://elliot.website/editor/

It reminded me of this discussion. It would be nice to be able to mix typeset math into code. It should be possible for basic equations.

Emacs org-mode is a successful predecessor in this regard, though it doesn’t have a genuine rendering engine.

In practice rare kinds of components of a structured document need to be rendered lively graphically, formulas, tables, figures and so on, noting that the starting point of TeXmacs is to avoid distractions instead of creating crazy fancy nonsense, IIRC. Personally if Emacs has lively rendered boxes within which I can edit formula etc. just as in TeXmacs, that’s enough.