Opened 12 years ago
Closed 12 years ago
#360 closed bug (wontfix)
export not working properly if procedure loaded via LIB
Reported by: | ren | Owned by: | hannes |
---|---|---|---|
Priority: | minor | Milestone: | 3-1-4 and higher |
Component: | dontKnow | Version: | 3-1-3 |
Keywords: | export, keepring | Cc: |
Description
assuming I have a file called testingexport.txt (or .lib) with following content:
proc testingexport(int n) { int result=n; export(result); }
Now if I do the following, everything works fine:
SINGULAR / Development A Computer Algebra System for Polynomial Computations / version 3-1-3 0< by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann \ March 2011 FB Mathematik der Universitaet, D-67653 Kaiserslautern \ created type 518 (cone) created type 519 (fan) // ** executing /home/ren/trunk/Singular/LIB/.singularrc > <"testingexport.txt"; > testingexport(2); > listvar(all); // result [0] int 2
But this does not work:
SINGULAR / Development A Computer Algebra System for Polynomial Computations / version 3-1-3 0< by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann \ March 2011 FB Mathematik der Universitaet, D-67653 Kaiserslautern \ created type 518 (cone) created type 519 (fan) // ** executing /home/ren/trunk/Singular/LIB/.singularrc > LIB "testingexport.txt"; // ** loaded /home/ren/trunk/Singular/LIB/testingexport.txt // ** library testingexport.txt has old format. This format is still accepted, // ** but for functionality you may wish to change to the new // ** format. Please refer to the manual for further information. > testingexport(2); > listvar(all); > result; ? `result` is undefined ? error occurred in or before STDIN line 5: `result;`
The same holds true for "keepring": In both cases, the ring of the procedure is kept, however in the second case Singular forgets what the ring is called. With the procedure
proc testkeepring(int n) { ring r=0,x(1..n),dp; keepring r; }
one gets:
SINGULAR / Development A Computer Algebra System for Polynomial Computations / version 3-1-3 0< by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann \ March 2011 FB Mathematik der Universitaet, D-67653 Kaiserslautern \ created type 518 (cone) created type 519 (fan) // ** executing /home/ren/trunk/Singular/LIB/.singularrc > LIB "testingexport.txt"; // ** loaded /home/ren/trunk/Singular/LIB/testingexport.txt // ** library testingexport.txt has old format. This format is still accepted, // ** but for functionality you may wish to change to the new // ** format. Please refer to the manual for further information. > testkeepring(2); > basering; // characteristic : 0 // number of vars : 2 // block 1 : ordering dp // : names x(1) x(2) // block 2 : ordering C > r; ? `r` is undefined ? error occurred in or before STDIN line 4: `r;`
Change History (2)
comment:1 Changed 12 years ago by
Owner: | changed from somebody to hannes |
---|
comment:2 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
If you want the variable result to defined on Top, then you have use exportto(Top,result);
Add to your file this proc:
and see that it works fine.
The manual
says that keepring is obsolete. But if you want to use keepring then call first exportto.
Add this proc:
And everything should work as you want:
See also what I say in the forum about global variables in Libraries
http://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1927
BTW: 1.) Why do you use a Developper version of Singular? The lastest patches are in UNIX/nighltybuild