What's the status of the new scheme on TeXmacs? Also, what is the status of the new release?

The other problem I have with Mogan is that some of the text on the UI looks uncomfortably small depending on which computer and/or monitor I use. I think it might have to do with High DPI settings or something like that, but I have not been able to fix it. (third row of text in the image below)

Screenshot%202023-03-22%20133409

S7 is actively developed and works perfectly, as far as I can see. It can even compile to wasm while this is not possible with the other schemes. Chez is difficult to embed nicely since TeXmacs retains a lot of Scheme values and the garbage collector move them around creating havoc. I’ve started a port but then realized the problem. This would need more serious investigation. Also: it is not clear that Chez will be actually faster than S7 or Guile 1.8 due to the way we use Scheme: we inject a lot of code which has to be compiled or interpreted online, so any compiler will be slower than a good interpreter (this is the same problem you have in browsers with Javascript, you cannot compile everything unless you want to be very slow in everything which is short lived). Guile 3 is actually used in interpreted mode in TeXmacs, and the only advantage it has wrt. to Guile 2 is that the interpreted run as fast as in Guile1.8… So for the moment the only way out is to embed in TeXmacs Guile 1.8 or let S7 do its fine job. The scheme in TeXmacs is quite peculiar…

2 Likes

Do you have a link to the current S7 source code and documentation?

https://ccrma.stanford.edu/software/snd/snd/s7.html
https://cm-gitlab.stanford.edu/bil/s7

I looked for this earlier today and the site was down for me as well, but it’s up again.

1 Like

Oh cool! It was down for a couple of days for me, so I just assumed it is a dead project.

Thanks for the link.

I remember you talking about a bug when using S7 in TeXmacs. Do I remember well?

There is a small patch to be applied to the source code in order to remove a slowness problem. As far as I can see the patch does not generates bugs, but the main developer didn’t wanted to include it in the main release, which is fine for us. If I find that the patch is not safe we will find another solution, but for the moment I think we can live with it. It is not related to a bug, just that the way TeXmacs use scheme does not play well with some implementation details of S7.

I’ve updated the wip_s7 branch of TeXmacs on github a couple of months ago, so one can use it instead of Mogan, if one does not like the latter.

1 Like

Thanks for the explanation.
If I were @vdhoeven :wink:

  • either include the S7 or the Guile 1.8 code with TeXmacs
  • put back into Debian and Ubuntu repositories

He is already working (well Lisa is :)) towards integrating Guile 1.8, at least for Android, as far as I can see: https://github.com/lizabelos/texmacs-android

2 Likes

Just curious: Would it be a major undertaking to make TeXmacs take advantage of compiled scheme rather than interpreted?

I’m thinking of emacs as an example. It was strictly interpreted lisp, but they added native compilation (jit) and that made things considerably faster. The editor is able to take advantage of pre-compiled functions (some are still interpreted). Although from what I understand, a much larger portion of emacs is written in lisp as opposed to TeXmacs which is mostly C++. Is that the source of the difficulty?

The real problem is that scheme implementations are not very fast to compile. TeXmacs C++ code create scheme snippets on the fly essentially every time there is some input (e.g. from the keyboard). These snippets have to be parsed and eventually compiled before running, but this is really not worthwhile since they will only run once. Some caching is done but you cannot cache much because many things can change. So at the end compilation does not buy much in general. Again: this is the same problem you have in browsers. If you want JIT you just need a very rough but fast JIT compiler and this is not what usually the scheme implementation do. It should be said that we do not have performance problems from Scheme. Actually TeXmacs is quite usable even when compiled to web assembly. So I do not see reason to spend much energy in this direction, we have more interesting things to develop. And S7 is a very fast and daily maintained scheme, see the benchmarks here: https://ecraven.github.io/r7rs-benchmarks/ Also: S7 compiled to webassembly, while a more complex scheme (e.g. Chez or Guile) would no the easy to port, I guess.

1 Like

For ChezScheme, the problem is that for other arch, we have to spare time to make it work.

GNU TeXmacs on S7 Scheme works on loongarch. Recently, I bought a PC using Loongarch CPU (3A5000) and just tested Mogan on Loongarch, it works fine.

Please submit a bug report to Github/Gitee/Codeburg.

Github is blocking the Russian coders, that’s why mogan is hosted on the above three platforms.

Submitted the issue!

1 Like

Fair enough! My understanding is the browser runs some of the code in interpreted mode and some compiled. I was thinking the same thing for TeXmacs, but as you say, that is not necessary.

Is running TeXmacs in webassembly something people are working on?

@yufens is working on the webassembly port of Mogan based on @mgubi 's work.

You can try online via https://mogan.app

To clarify, Mogan is a community driven project. It is not for profit. As a result, the wasm version of Mogan will never require a login.

I’m exploring the design space in Vau (https://github.com/mgubi/vau) which at the moment is going to be a web viewer for TeXmacs files, but which is also a test to see how to “grow” a web application which uses the core of TeXmacs typesetter. In my opinion the full TeXmacs app is not a useful web app. Desktop =/ web and a web app has other requirements and therefore needs another interface, maybe simpler and single window, with less toolbars and relying on HTML+CSS for UI. But I do think that is strategically important that we deliver some functionalities via the browsers, in an app which can be run without installation and possibly which make easy to collaborate.

Found a guile3 cygwin package, I don’t have a working Windows though.
http://ftp.cygwin.com/cygwin/packages/summary/guile3.0-src.html

1 Like

I don’t know much about what the different build options are for Windows. I’ve seen people mention Cygwin, MinGW, MSYS2 and MXE, but I’m not completely sure what they all do.

I see there’s also a Guile 3 packages for MSYS2:
https://packages.msys2.org/base/guile

Yet, there’s also this issue

Then there’s this discussion on MinGW on the Guile mailing list:
https://lists.gnu.org/archive/html/guile-devel/2023-01/msg00065.html
and this work in progress git branch:
https://git.savannah.gnu.org/cgit/guile.git/log/?h=wip-mingw

I don’t know how all of this ties together and what would be needed for TeXmacs on Windows. Perhaps someone with more Windows expertise can chime in?