Does scheme serve as a filter for TeXmacs extension submissions much like LaTeX does for paper submissions in math/CS?

If this is not the case, why not promote a language for TeXmacs extensions that everyone understands and likes such as Python?

No, for the simple reason that you don’t need to know Scheme to write a document in TeXmacs.

I’ve changed the title to make it more clear what I mean.

As far as I understood, Python is not fast enough to do real-time typesetting.
Other forum members might have more insight.
Said this, it is possible to generate a typeset box using a Python script. This intuitively looks less flexible than a macro with parameters. Maybe here too someone else will have more insight.

By the way, it is worth to give a try to Scheme. It has defects, the biggest one that I see is the lack of standardization, but you might find it fun.

If Python is not fast enough, then maybe try Julia?

It should be said that TeXmacs has been around since the late nineties. Python wasn’t as developed back then as it is now. Julia didn’t even exist, of course.

It’s for from a trivial task to “try” another scripting language. Have a look at the amount of Scheme code in TeXmacs. Even changing to a different version of Scheme is tricky.

Finally, if you wish you can do many things in whatever language you prefer via plugins.

That the fundamental reason for scheme is different, and it is explained by Joris in the manual which comes with the program (is anybody reading it? it is worth even if a bit outdated in some parts). Scheme and in general Lisp provide facilities to construct new programming languages on top of existing ones. This feature is not available in other languages. Not even in more advanced ones like Haskell. So you can think of it as a language programming language (Racket made of this a full philosophy). This is not possible in Python.

So strictly speaking, any Lisp-like language is not a single language but a collection of sublanguages which are modelled for a specific purpose. In the case of TeXmacs, this purpose is the definition of the UI (menus, keybindings, etc…) and of certain semantic aspects of documents and document macros.

If you just remain at the surface syntax you miss the point.

Maybe you should ask yourself: could be possible to write a program like TeXmacs without scheme?

Can you give me other examples of large programs with successful scripting support? The only other examples I have now in mind are TeX (texmacs macro language), Emacs (Lisp) and browsers (Javascript).

Btw, if you have julia, try to run

 julia --lisp

Julia’s parser is written in scheme.

As @jeroen said, you can write plugins in python (actually we already do) or in any other language you like, even assembler, TeXmacs has a compact interface protocol for plugins.

So the outline plugin could have been written in python?

No, sorry. I should have been more precise. Actually there are various kind of “plugins” and various level of integration possible. If you want to interface to an external language, e.g. “Mathematica” then there is a protocol for that and you can implement it in any language you like, e.g. Python.

If you need to extend the user interface, the keybindings and the menus, and provide additional functionalities in the editor then you have to write scheme code. A parallel could be drawn with applications like “Atom” or “Visual Studio Code” or “Zotero”: there the scripting languages is a mix of CSS, HTML and Javascript for the underlying browser engine. Instead of this triad, we use Scheme.

The fact that the outline plugin exists is a signal that users do contribute code written in scheme.

What is that you find difficult, or that could be more easily accomplished in another language?

Most people don’t want to program using a functional language.

Would it be possible to extend Python support to allow creation of plugins such as the outline one?

I don’t think that that is true. The most popular languages are not functional per se, yes, but Haskell and Clojure seem to be fairly popular:

Note that there’s also the plugin-eval function in TeXmacs to outsource functionality from Scheme to other languages. For the outline plugin this wouldn’t be of much use, though, as it relies heavily on the tree structure and the interface, both of which are accessed via Scheme.

Maybe a preference for WYSIWYG editing is highly correlated with a dislike of functional languages?

If this is the case, then most users of TeXmacs would not want to program using a functional language.

Do you have any evidence to support such a claim?

I don’t have evidence for it but it might be worth looking into.

BTW, functional languages (and formal methods) are more of a European thing.

If you want more TeXmacs extension contributions from the US/Canada, then Python/Julia would probably be better for that.

Having the possibility of writing code for TeXmacs in an additional language, I mean beside Scheme, could be good. You could perhaps prepare a very tiny prototype, by implementing with Julia a few of the glue functions that are now written with Guile, in such a way that one has then in TeXmacs a tag to call these Julia glue functions, analogous to the “extern” tag that allows calling Guile functions. I do not know and I am not able to estimate how much time and energy you would need to do that, but perhaps it is a reasonable amount of work, id est an expert programmer can do this in twenty hours.
Maybe if the result looks good, it will be enough to convince someone else to work on this.
On “people not wanting to program in functional languages”: then they are missing on some fun :slight_smile:.

BTW, functional languages (and formal methods) are more of a European thing.

Again, do you have any evidence for that?

A quick look on the Wikipedia page for functional programming tells me, for example

The first functional programming language, LISP, was developed in the late 1950s for the IBM 700/7000 series of scientific computers by John McCarthy while at Massachusetts Institute of Technology (MIT).

Scheme is no more functional than python or modern C++. You can program in a functional style or in an OOP style and some programming languages support better some style or others. Then you have pure functional languages (in which you cannot mutate variables), but scheme is not of this kind. You can mutate all the variables you want. Actually it is done often in TeXmacs. If you really want to put things into cases here it goes: the style of programming used in the scheme part of TeXmacs is multiple dispatch (a function behaviour depends on the arguments and even on the current state of the system), while the C++ part is coded in a mostly functional style with very few uses of OOP features like virtual functions.

Just look at the top US software companies such as Google, Apple, and Microsoft. The vast majority of programming there is not done in a functional language. This is also true of game companies.

It sounds like Julia would be a good match with the multiple dispatch used…