--
You received this message because you are subscribed to the Google Groups "chez-scheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chez-scheme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chez-scheme/d5c59522-e51d-49be-a8b4-6b723a1cb068n%40googlegroups.com.
On 10. Jan 2021, at 18:11, Jens Axel Søgaard <jens...@soegaard.net> wrote:Hi,
I am curious, the current module system used by TeXmacs, is that the same as
the current module system used in Guile?
For context (for the Chez Schemers):
https://texmacs.github.io/notes/docs/scheming.html
PS:
I have fond memories of TeXmacs - I used to write my masters thesis years ago.
Our modules start with (texmacs-module .. ) but of course this is a macro build on top of Guile (module ...). But we do not do anything fancy. Essentially modules export some bindings with define-public or define-public-macro and the modules are bring in (maybe lazily not to affect interactivity) into an interactive top-level which is where the call from C++ to Scheme happen and where are also evaluated all the Scheme code needed to typeset the documents (documents can contain TeXmacs macros which renders content via calls to Scheme).
[When I solved the module problem I need to attack the problem of our second facility: globally defined overloaded functions: i.e. any module can redefine certain global bindings to add some more behaviours (e.g. conditionally on the present status of the editor, certain procedures can behave differently).]
For context (for the Chez Schemers):
https://texmacs.github.io/notes/docs/scheming.html
PS:
I have fond memories of TeXmacs - I used to write my masters thesis years ago.PS: I'm glad you appreciate it. I also use it everyday for my work (teaching/research). :)
Also the blog you link above is completely written in TeXmacs and then converted to HTML.
On 10. Jan 2021, at 19:12, Jens Axel Søgaard <jens...@soegaard.net> wrote:Hi,
Thanks for explanation.Our modules start with (texmacs-module .. ) but of course this is a macro build on top of Guile (module ...). But we do not do anything fancy. Essentially modules export some bindings with define-public or define-public-macro and the modules are bring in (maybe lazily not to affect interactivity) into an interactive top-level which is where the call from C++ to Scheme happen and where are also evaluated all the Scheme code needed to typeset the documents (documents can contain TeXmacs macros which renders content via calls to Scheme).
Since you mention "interactive top-level" it sounds like you can represent TeXMacs modules with Chez Scheme environments?
Environments have the operation environment-symbols.
I am no expert in Chez Scheme, but I wouldn't be surprised if there already exists alternative module systems for Chez.
[When I solved the module problem I need to attack the problem of our second facility: globally defined overloaded functions: i.e. any module can redefine certain global bindings to add some more behaviours (e.g. conditionally on the present status of the editor, certain procedures can behave differently).]
The price of globally defined overloaded functions is that the compiler might now produce as efficient code
as it would have with a more static approach.
Hi all,I'm trying to understand Chez, in particular to use it to run the Scheme code in GNU TeXmacs (www.texmacs.org) which has two specific features (originally implemented on top of Guile): a module system and globally overloadable procedures. My current plan is to implement TeXmacs module system with Chez modules, essentially because I want the interactive top-level to be accessible from within the modules but I want to retain control of the exported symbols. However I cannot find a way to "introspect" a module for the list of the exported bindings. E.g. is it possible to access this information from within the module (and make it available outside the module via some mechanism)? Since libraries can be queried for the exported symbols and there is the apropos function I imagine that there should be some infrastructure for such introspection. Somebody can give me some pointers/suggestions?
Can somebody point me out to some example of using a different expander for the code than sc-expand, I would like to have in my code reserved keywords like 'export' which is not allowed by the standard expander. At the moment i go around simply renaming export as tm-export in the source files but I would like a less intrusive way to construct a custom language on top of chez scheme.
For the moment I'm fighting crashes in the glue code with our C++ side. It was written for Guile which do not move around scheme objects... I think I need some rethinking there...
On another side: I'm slowly learning Scheme and I noticed the following basic fact, take the definition of include in TSPL, it uses a loop of the form
(let f ([x (read p)])
(if (eof-object? x)
(begin (close-port p) '())
(cons (datum->syntax k x) (f (read p))))))))
which is not tail recursive in f as far as I understand. Is this so?
And in the case, why it is not a problem?
I would expect to run out of stack if the file is really big.
I've tried to write a tail recursive version but it seems to me that I need reverse,
which I think has the same problem.
Another approach I can think of would need mutable pairs. What I'm missing?
Dear Jens,thanks a lot for all the example code. Two/three remarks on libraries and modules:1) I've looked into the expander and it seems to me that libraries in Chez are implemented on top of modules (I might be wrong),
so there should be some code which introspect the bindings in order to implement library-exports.
However these mechanisms are not made available for modules.
2) A problem with libraries and modules is that, the docs says that definitions should come before initialization code,
which is not the case in the way texmacs modules are written (at the top-level).
So for the moment I'm stuck with reading the files with load (which evaluate one expression at the time).
3) I've read all the papers on syntactic abstractions, they are really interesting and beautiful. There is even a paper on a module system designed for interactive programming:Tung, SH.S., Dybvig, R.K. Reliable interactive programming with modules. Lisp and Symbolic Computation 9, 343–358 (1996). https://doi.org/10.1007/BF01806317which I do not understand if is/can be implemented in Chez. It would seem to be part of what I would have needed. Somebody know a bit more about the history of this proposal?
On 14. Jan 2021, at 16:03, Jens Axel Søgaard <jens...@soegaard.net> wrote:
2) A problem with libraries and modules is that, the docs says that definitions should come before initialization code,which is not the case in the way texmacs modules are written (at the top-level).So for the moment I'm stuck with reading the files with load (which evaluate one expression at the time).
Do you have code that use set! before define?
I don't think that has been allowed for ages (in the RnRS specs).