|
|
last edited 10 years ago by test1 |
1 2 | ||
Editor:
Time: 2007/11/17 22:34:27 GMT-8 |
||
Note: add bug demo |
changed: - This page demonstrages a bug with setelt. From the first report by Bill Wood: http://lists.nongnu.org/archive/html/axiom-mail/2007-08/msg00012.html \begin{axiom} init_rec() == (r : Record(k: INT, rad: INT) := [0,0]; r) xs := [init_rec() for i in 1..3]; ys := oneDimensionalArray(xs); xs(2).k := 5 xs.2.k := 5 ys(2).k := 10 ys.2.k := 5 \end{axiom} Here is a demonstration that shows that the Aldor compiler has no problem with that construction. \begin{aldor} #include "axiom" INT ==> Integer; R ==> Record(k: INT, rad: INT); initrec(): R == [0,0]; myfoo(): OneDimensionalArray R == { xs: List R := [initrec() for i in 1..3]; ys: OneDimensionalArray R := oneDimensionalArray(xs); ys(2).k := 10; ys } \end{aldor} \begin{axiom} zs:=myfoo() \end{axiom} And the following code demonstrates that the problem lies in the interpreter and not in the SPAD compiler. \begin{spad} )abbrev package BBB MyPkg INT==> Integer R ==> Record(k: INT, rad: INT) MyPkg(): with myfoo2: () -> OneDimensionalArray R == add initrec2(): R == [0,0] myfoo2(): OneDimensionalArray R == xs: List R := [initrec2() for i in 1..3] ys: OneDimensionalArray R := oneDimensionalArray(xs) ys(2).k := 10 ys \end{spad} \begin{axiom} zs:=myfoo2() \end{axiom}
This page demonstrages a bug with setelt.
From the first report by Bill Wood:
http://lists.nongnu.org/archive/html/axiom-mail/2007-08/msg00012.html
init_rec() == (r : Record(k: INT,rad: INT) := [0, 0]; r)
xs := [init_rec() for i in 1..3];
Compiling function init_rec with type () -> Record(k: Integer,rad: Integer)
ys := oneDimensionalArray(xs);
xs(2).k := 5
The form on the left hand side of an assignment must be a single variable,a Tuple of variables or a reference to an entry in an object supporting the setelt operation. xs.2.k := 5
The form on the left hand side of an assignment must be a single variable,a Tuple of variables or a reference to an entry in an object supporting the setelt operation. ys(2).k := 10
The form on the left hand side of an assignment must be a single variable,a Tuple of variables or a reference to an entry in an object supporting the setelt operation. ys.2.k := 5
The form on the left hand side of an assignment must be a single variable,a Tuple of variables or a reference to an entry in an object supporting the setelt operation.
Here is a demonstration that shows that the Aldor compiler has no problem with that construction.
#include "axiom" INT ==> Integer; R ==> Record(k: INT,rad: INT); initrec(): R == [0, 0]; myfoo(): OneDimensionalArray R == { xs: List R := [initrec() for i in 1..3]; ys: OneDimensionalArray R := oneDimensionalArray(xs); ys(2).k := 10; ys }
Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3344069441329748634-25px002.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra Use the system command )set compiler args to change these options. Program fault (segmentation violation).#1 (Error) Program fault (segmentation violation). The )library system command was not called after compilation.
zs:=myfoo()
There are no library operations named myfoo Use HyperDoc Browse or issue )what op myfoo to learn if there is any operation containing " myfoo " in its name.
Cannot find a no-argument definition or library operation named myfoo .
And the following code demonstrates that the problem lies in the interpreter and not in the SPAD compiler.
)abbrev package BBB MyPkg
INT==> Integer R ==> Record(k: INT,rad: INT)
MyPkg(): with myfoo2: () -> OneDimensionalArray R == add initrec2(): R == [0,0]
myfoo2(): OneDimensionalArray R == xs: List R := [initrec2() for i in 1..3] ys: OneDimensionalArray R := oneDimensionalArray(xs) ys(2).k := 10 ys
Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8672852723378779648-25px004.spad using old system compiler. BBB abbreviates package MyPkg ------------------------------------------------------------------------ initializing NRLIB BBB for MyPkg compiling into NRLIB BBB compiling local initrec2 : () -> Record(k: Integer,rad: Integer) BBB;initrec2 is replaced by CONS00 Time: 0 SEC.
compiling exported myfoo2 : () -> OneDimensionalArray Record(k: Integer,rad: Integer) Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |MyPkg| REDEFINED
;;; *** |MyPkg| REDEFINED Time: 0.01 SEC.
Cumulative Statistics for Constructor MyPkg Time: 0.01 seconds
finalizing NRLIB BBB Processing MyPkg for Browser database: --->-->MyPkg(constructor): Not documented!!!! --->-->MyPkg((myfoo2 ((OneDimensionalArray (Record (: k (Integer)) (: rad (Integer))))))): Not documented!!!! --->-->MyPkg(): Missing Description ; compiling file "/var/aw/var/LatexWiki/BBB.NRLIB/BBB.lsp" (written 15 APR 2014 05:29:48 PM):
; /var/aw/var/LatexWiki/BBB.NRLIB/BBB.fasl written ; compilation finished in 0:00:00.017 ------------------------------------------------------------------------ MyPkg is now explicitly exposed in frame initial MyPkg will be automatically loaded when needed from /var/aw/var/LatexWiki/BBB.NRLIB/BBB
zs:=myfoo2()
(1) |