#2638 wxdraw gives an error after load(draw);kill(all);load(draw);

None
closed
nobody
None
5
2014-03-02
2013-10-05
Rudolf Langer
No

This produces an error with Maxima 5.30.0 and 5.31.1-1, but is working in 5.28:

load(draw);
kill(all);
load(draw);
wxdraw3d(points([[1,2,3]]));

If using draw3d instead of wxdraw3d its working too. Some students in our school uses big portfolios with several chapters, every chapter usually starts with kill(all). If there are two or more chapters with load(draw) you'll get the error if you use the new version of maxima and evalute all cells...

1 Attachments

Discussion

  • I don't know what's happening here. Try to use

    remvalue(all);

    instead.

    --
    Mario

     
  • Rudolf Langer
    Rudolf Langer
    2013-10-06

    remvalue(all);
    ...is working (no error), but user defined functions are not removed!

    And in addition its painful to change all old student portfolios. I guess we have to stick with Version 5.28. Anyway, in 5.31.1-1 realroots() without setting rootsepsilon per hand isn't working too - another thing we would have to change in old wxm files. Hopefully everything is working in the next version of maxima.

    Thanks and best regards,
    Rudi.

     
  • Robert Dodier
    Robert Dodier
    2013-10-07

    Verified this bug using Maxima 5.31.2 + wxMaxima 11.08.0 on Linux. Here is a simpler version of it. This version of the bug appears in command-line Maxima too.

    (%i1) load (draw);
    ;;  Loading file /home/robert/.maxima/binary/binary-clisp/share/draw/grcommon.fas ...
    ;;  Loaded file /home/robert/.maxima/binary/binary-clisp/share/draw/grcommon.fas
    ;;  Loading file /home/robert/.maxima/binary/binary-clisp/share/draw/gnuplot.fas ...
    ;;  Loaded file /home/robert/.maxima/binary/binary-clisp/share/draw/gnuplot.fas
    ;;  Loading file /home/robert/.maxima/binary/binary-clisp/share/draw/vtk.fas ...
    ;;  Loaded file /home/robert/.maxima/binary/binary-clisp/share/draw/vtk.fas
    ;;  Loading file /home/robert/.maxima/binary/binary-clisp/share/draw/picture.fas ...
    ;;  Loaded file /home/robert/.maxima/binary/binary-clisp/share/draw/picture.fas
    0 errors, 0 warnings
    (%o1)            /usr/share/maxima/5.31.2/share/draw/draw.lisp
    (%i2) :lisp ($get '$draw '$version)
    2
    (%i2) kill (all);
    (%o0)                                done
    (%i1) load (draw);
    0 errors, 0 warnings
    (%o1)            /usr/share/maxima/5.31.2/share/draw/draw.lisp
    (%i2) :lisp ($get '$draw '$version)
    NIL
    

    Note that the $version property of $draw is not set the second time load(draw) is evaluated. That is because load(draw) uses defsystem to load the package, and since from the Lisp point of view, draw is already loaded (kill(all) has no effect on defsystem's idea of whether the package is loaded), the $put necessary to set the property is not evaluated.

    I think this is a bug in draw. The mechanism by which the package is loaded should ensure that everything gets defined as needed. I don't have any advice as to how to accomplish that in this case.

    For the record, wxdraw evaluates (= ($get '$draw '$version) 1) which causes the error. It is probably easy to patch wxMaxima to work around the bug, although I don't have a patch.

     
  • As a workaround, writing eq instead of = in

    (= ($get '$draw '$version) 1)

    wxdraw works as expected and the problem goes away. I don't know at this moment if I have enough writing permissions for commiting the patch myself to wxmaxima.

    The get-put mechanism worked fine before using defsystem. Other defsystem-based packages may have the same problem in the future.

    On the other hand, we could use something like

    (defvar $draw_version 2)

    for saving the package version. defvar's are not affected by kill.

    Thanks, Robert, for looking at this.

    --
    Mario

     
  • Robert Dodier
    Robert Dodier
    2013-10-09

    The get-put mechanism worked fine before using defsystem.

    I think the (= ($get '$draw '$version) 1 is recent in wxMaxima -- my guess is that the defsystem scheme for loading 'draw' never redefined the version property, but it didn't cause any trouble before.

    About using defvar, I think that would work, but you would have to review the 'draw' source code to ensure that there aren't any other Maxima properties which need to be redefined or handled differently.

     
  • There isn't any other problem.

    demo ("draw_gnuplot.dem") $

    works fine after executing

    load(draw)$ kill(all)$

    both in command line and wxMaxima (with eq). I already asked Andrej for this change.

    I won't remove the $get command for the moment, since some third party packages could need it.

    But I'll introduce the defvar mechanism, just like the rest of other internal variables used by draw.

    I think these changes will solve the problem.

    Rudolf, you don't need to reload package draw after the kill command.

    --
    Mario

     
  • zigarrre
    zigarrre
    2013-12-20

    As nobody submitted a patch or a detailed fix i post mine here.

    To be honest I have no clue of LISP and made that patch only with the information in this discussion and a diff between the current draw.lisp file and an old one (which didn't had this bug). So it's maybe a hack but it works fine. I've tested it under Arch Linux with v5.31.0.

    The patch should be applied to the share/draw/draw.lisp file.

    I hope I could help and that this will be merged or fixed in a better way soon!

     
    Attachments
  • Robert Dodier
    Robert Dodier
    2014-03-02

    I believe this bug is fixed by commit 7e14b0 as shown below. Closing this report accordingly.

    $ git show 7e14b0fd50072b428fc99104d6084c3b4ba6b05c
    commit 7e14b0fd50072b428fc99104d6084c3b4ba6b05c
    Author: Mario Rodriguez <riotorto@users.sourceforge.net>
    Date:   Sat Dec 28 20:41:16 2013 +0100
    
        Temporal fix until next wxMaxima release
    
    diff --git a/share/draw/draw.lisp b/share/draw/draw.lisp
    index e358b50..9e911e4 100644
    --- a/share/draw/draw.lisp
    +++ b/share/draw/draw.lisp
    @@ -1,5 +1,7 @@
     (in-package #-gcl #:maxima #+gcl "MAXIMA")
    
    +($put '$draw 2 '$version)
    +
     #+ecl ($load "lisp-utils/defsystem.lisp")
    
     (load (merge-pathnames (make-pathname :name "draw" :type "system")
    
     
  • Robert Dodier
    Robert Dodier
    2014-03-02

    • status: open --> closed