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

It’s a reasonable assumption to make when a software is not updated for a while or if the website doesn’t work (which was the case for S7). At least TeXmacs has a relatively up to date github; hopefully there’s a new binary release soon too.

I write a new toy scheme, https://github.com/PikachuHy/pscm

One of its goals is to build a windows native texmacs, which means we can build texmacs with MSVC.

I don’t know how long it will take.

The first step, I think, is to build Vau (https://github.com/mgubi/vau) with my pscm.

Currently, the wasm version is available: https://pscm.dev/demo.html

Nice project! Please be aware that it is a nontrivial task. I’ve tried to embed other schemes and they are too slow to be usable. For example Chibi. For TeXmacs it is critical to have a fast parser and interpreter and also symbol lookup (because the sources define tons of symbols which have to be resolved during calls). I fear that a naive implementation would be not viable. S7 has a lot of optimisations and even Guile 2 interpreter (written in Scheme and compiled) is too slow for running TeXmacs. One had to wait for the Guile 3 interpreter to match the speed of Guile 1.8.

I looked at femtolisp which is quite fast (even in the benchmarks). If however you insist in want to develop you own scheme then I would like to suggest you try to allow it to work with TeXmacs’ strings so that we do not have to convert them back and forth. Joris was also of the opinion that we need our own interpreter.

I looked at femtolisp which is quite fast (even in the benchmarks).

where is the benchmarks code?

try to allow it to work with TeXmacs’ strings so that we do not have to convert them back and forth.

good idea

we can do more TeXmacs-specific optimization.

Here: https://ecraven.github.io/r7rs-benchmarks/

If I’m not mistaken, S7 was specifically written to work well with another software. So going that way for TeXmacs is not a bad idea.

I’m not sure what you mean. S7 has no specific problem to be embedded in TeXmacs. I do not know if it has been “designed” to work with another software. I do not see any specific design decision which make it bad for TeXmacs. If we can have a performant interpreter which uses TeXmacs internal data-structures that would remove a lot of overhead between C++ and Scheme, but write a good interpreter does not seems an easy task (otherwise there will be more fast interpreters around…). Anyway, kudos to @pikachuhy for initiating the project. Let me know if you need help with Vau integration. (btw: Vau does not currently use a lot of Scheme since all the UI part has been disabled, so it is not a good test for a new interpreter). Porting TeXmacs to a new scheme is very easy on the C++ side, it would take some more work to have all the Scheme primitives which are needed to run our Scheme code.

According to their website, S7 was designed as an extension language to their sound editor software.

I’m not saying S7 is unsuitable for other tasks. Just saying that they wrote it to use in their software because no other scheme suited their purposes.

Where they say so? The initial paragraph says:

s7 is a Scheme interpreter intended as an extension language for other applications.
[...]
 s7 is an extension language of Snd and sndlib ([snd](http://ccrma.stanford.edu/software/snd/index.html)), Rick Taube's Common Music (commonmusic at sourceforge), Kjetil Matheussen's Radium music editor, and Iain Duncan's Scheme for Max (or Pd)
[...]

I cannot find the fact that it was “designed for…”. My experience is that it is a very good software which is daily maintained (see the git log here https://cm-gitlab.stanford.edu/bil/s7/commits/master) by a very competent programmer. The fact that people do not know it does not mean that it is not good or unfit for other purposes. See for example this experience in embedding it in a game setting : https://carloscarrasco.com/love-letter-to-s7-scheme/

Personally I think it is even better than Guile, less elegant maybe, but with a lot of cool features and it is programmed with a lot of taste and love, what do you want more from a piece of software?

I do not know how TeXmacs uses Scheme, but is it possible to make interpreter-independent codes of TeXmacs as few as possible, so that it would not be so painful to migrate from one to another?

Again, I don’t disagree with any of that. That’s not my point.

You are right, they don’t specifically say “designed for”, but the fact that’s explicitly mentioned in the documentation page seems to suggest that to me. If someone knows otherwise, feel free to correct me. And again, that doesn’t mean that it was designed “only” for that software.

EDIT: Also, I’m not the only one with this interpretation: https://iainctduncan.github.io/scheme-for-max-docs/s7.html

S7 Scheme is a minimal scheme designed specifically for embedding in music contexts,

TeXmacs uses general (r5rs) scheme construct + lisp-style macros but some mechanisms need a module systems or some way to manage environments. This last feature is not available in some schemes (e.g. chibi) and this make difficult porting. Otherwise porting is quite easy, since only few definitions have to be fine-tuned to a specific scheme. The current codebase works with few changes for Guile 1.8 and S7. In interpreted mode it will work also for Guile 3 but there we need some more substantial changes. Scheme being scheme in general porting can be approached as writing an interpreter for TeXmacs-scheme on top of your preferred scheme implementation. This is however not the way we operate right now and we rely on a literal interpretation of the code which requires some cooperation from the interpreter.

Why not just take Guile 1.8.8 and rebrand it as Texmacs scheme? Is Guile 1.8.8 broken in some way that makes it unsuitable? I don’t know anything about the interpreters, just asking.

Well guile 1.8 is obsolete and unmaintained. If any critical vulnerability shows up we’re on our own for fixing it. Furthermore, even without critical vulnerabilities, guile 1.8 is outdated. For instance, it does not know about utf-8 strings and AFAIR this causes that guile cannot access TEXMACS_HOME_PATH on windows when your user name has unicode characters, making TeXmacs unusable in that case.

2 Likes

Utf-8 strings would be nice. I occasionally get weird errors when paths contain letters with accents.

Since you mentioned, where is the TEXMACS_HOME_PATH on Windows?

The easiest way to get it is probably to open a Scheme session and evaluate (get-texmacs-home-path).

Please report the errors, and we will fix it.

IIRC $TEXMACS_HOME_PATH is usually in C:\Users\Your-user-name\AppData\Roaming\TeXmacs and I believe that AppData is normally hidden. Sorry for the late reply.

the vau can run with pscm now.
see the post: Run Vau success with pscm

3 Likes