Subject: On the interfaces between Lyx and CAS Hi,
I want to share with you, some ideas concerning the interface of Lyx with computer algebra systems, that perhaps might help to improve its design. Currently, Lyx has a somewhat rudimentary interface that allows one to select a expression in the math editor, and use a computer algebra system to compute the result. Three CAS are supported: GNU Octave, Maxima and Mathematica. Even though this is a nice feature to have, I think that a better design is needed. Obviously, this e-mail is speculative, just an starting point for discussion. First of all there are many other computer algebra systems out there, just to mention a few others: Scilab, Freelab (two Matlab clones), Pari/gp (used mostly in number theory), R (for statistics), Axiom (I think this is a very important one, since it is a really powerfull free software system, that it is a competent alternative to Mathematica or Maple, and it would be nice to support it), Yacas, GAP, Singular, Maple, ... (and the list could continue). So it would be nice to support many of them, wouldn't be? But the three named systems are hard-coded in the Lyx sources, as well as the rules for communicating with them. I think that this is not the best design: perhaps we may think of a plug-in architecture, for supporting them. Obviously this is not according to the Unix-way of programming, just to quote some well-known design principles that I've learnt from other people: "never try to do what the user will want to do with your program" and "design programs that do just one or two things but communicate with other programs". But I think that a better design is possible: For every possible program, all that is needed is a small program or script (that could be even written in a high-level, easy-to-debug language, say python, if we create some python bindings) that knows how to translate expressions between Lyx and the other program. These scripts might be external to Lyx, and registrate and communicate with Lyx using a well-documented API. This way, the developers of other projects (or their users) could contribute interfaces for communicating Lyx with their CAS, without needing to modify Lyx. Another problem that I see is that the current approach starts an instance of the program every time the user ask for a calculation to be performed, and closes it after that. For many CAS, like Axiom (or Mathematica) this means a great overhead, and is certainly not efficient. All we really need is a way to support "special cut and past" from Lyx to CAS, and from a CAS to Lyx. In this model, for example, if the user wants to perform some computations in Axiom (let's say) and Lyx, she would open two windows: one with Lyx, the other with Axiom, and cut and past between them, the expressions. This would be certainly a more user-friendly solution: she needs to open the CAS just one time. If the CAS gives an error message, she can see the output. She can even do some auxiliary computations that she won't copy into the Lyx document she is editing, and just paste the final result. I know that what I'm suggesting is not easy to implement (just like GUI-independence was much harder to implement than just choosing a new GUI-tooltik, but I think was the right solution). But it might lead to a more powerful Lyx. What do you think? Pablo De Napoli