Hi, Le 21/01/2015 17:49, Nils Bruin a écrit :
On Wednesday, January 21, 2015 at 2:39:52 AM UTC-8, Snark wrote:Ah, ha! That helps. But, let's take the following code (extracted from src/sage/interfaces/maxima_lib.py) : from sage.libs.ecl import * ecl_eval("(require 'maxima)") ecl_eval("(in-package :maxima)") ecl_eval("#$load(abs_integrate)$") it gives me: RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.And obviously, maxima_lib.py doesn't suffer from this problem, because the code there executes quite frequently without this error. Apparently there is something different between what you do and what happens in maxima_lib.py. Indeed, there is more code in maxima_lib.py. Right below the (in-package :maxima) we have: (defvar *MAXIMA-LANG-SUBDIR* NIL) (set-locale-subdir) (set-pathnames) and then load works. Maxima needs more initialization than requiring the package. A large part of maxima was already written before the CL standard was made and before packages were introduced, so it has a lot of archaic bits to the code. It certainly was never designed to be used as a lisp library, so you need to jump through odd hoops to get it to work as such. It may also be possible that maxima does have a better initialization routine that has everything packaged in, but I wasn't able to find it (and reverse engineering what WAS needed took quite a bit of trial and error).
Ah, ha! The "(set-pathnames)" was what I was missing. And sage-env sets an environment variable which gets used by that function to set the paths... Now I think I have the full picture !
Concerning the THROW: Maxima has its own error signalling mechanism that requires a guard on the stack to CATCH the THROWs. To put an appropriate catch in place, maxima_lib defines maxima-eval, which is hugely improved in: http://trac.sagemath.org/ticket/14308 I was fully expecting that ticket to be merged already, but apparently no-one cares about the issue there. It's still worth merging the much simpler implementation of maxima-eval, though.
I won't promise I'll have a look very soon, but I've added it to my list of interesting things to do with sage.
Thanks! Snark on #sagemath -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
