Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: SourceForge.net <noreply@so...>  20030806 00:35:46

Bugs item #783847, was opened at 20030805 19:35 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Barton Willis (willisb) Assigned to: Nobody/Anonymous (nobody) Summary: assignments to %i, inf, ... Initial Comment: Maxima allows assignments to %i, inf, ind, and und. An assignments to %i is especially troublesome (C1) %i : 42; (D1) 42 (C2) %i^2; (D2) 1764 The fix is to give $ind and $und the sysconst property. (The fix is mostly due to Stavros.) Thus change (simp.lisp) (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA))) to (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA $ind $und))) Additionally, I think it would be okay to give $unknown, $pos, $neg, $zero, $pz, $nz, $pn, and $pnz the sysconst property. Now disallow assignments to sysconsts by changing mset to (mlisp.lisp) to (DEFUN MSET (X Y) (declare (object y x)) (PROG NIL (COND ((OR (NULL $SETCHECK) (EQ $SETCHECK '$SETCHECK))) ((AND (OR (ATOM $SETCHECK) (MEMALIKE X (CDR $SETCHECK)) (AND (NOT (ATOM X)) (MEMALIKE (CAAR X) (CDR $SETCHECK)))) (NOT (EQ X Y))) (DISPLA (LIST '(MTEXT) (DISP2 X) ' set to  Y)) (IF $SETCHECKBREAK (LET (($SETVAL Y)) (MERRBREAK T) (SETQ Y $SETVAL))))) (COND ((ATOM X) (WHEN (OR (NOT (SYMBOLP X)) (MEMQ X '(T NIL)) (MGET X '$NUMER) (char= (GETCHARN X 1) #\&) (get x 'sysconst)) ;; prevent assignments to system consts (IF MUNBINDP (RETURN NIL)) (IF (MGET X '$NUMER) (MERROR "~:M improper value assignment to a numerical quantity" X) (MERROR "~:M improper value assignment" X))) (LET ((F (GET X 'ASSIGN))) (IF (AND F (OR (NOT (EQ X Y)) (MEMQ F '(NEVERSET READ ONLYASSIGN)))) (IF (EQ (FUNCALL F X Y) 'MUNBINDP) (RETURN NIL)))) (COND ((AND (NOT (BOUNDP X)) (NOT DSKSETP)) (ADD2LNC X $VALUES)) ((AND (NOT (EQ X Y)) (OPTIONP X)) (IF $OPTIONSET (MTELL "~:M option is being set.~%" X)) (IF (NOT (EQ X '$LINENUM)) (ADD2LNC X $MYOPTIONS)))) (RETURN (SET X Y))) ((MEMQ 'ARRAY (CDAR X)) (RETURN (ARRSTORE X Y))) ((AND $SUBSCRMAP (MEMQ (CAAR X) '(MLIST $MATRIX))) (RETURN (OUTERMAP1 'MSET X Y))) (T (MERROR "Improper value assignment:~% ~M" X))))) After the fixes (C1) load("mset.x86f"); (D2) mset.x86f (C3) und : 13; UND improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C4) inf : 34; INF improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C5) %i : 1; %I improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) Barton  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 
From: SourceForge.net <noreply@so...>  20030807 15:14:02

Bugs item #783847, was opened at 20030805 20:35 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Barton Willis (willisb) Assigned to: Nobody/Anonymous (nobody) Summary: assignments to %i, inf, ... Initial Comment: Maxima allows assignments to %i, inf, ind, and und. An assignments to %i is especially troublesome (C1) %i : 42; (D1) 42 (C2) %i^2; (D2) 1764 The fix is to give $ind and $und the sysconst property. (The fix is mostly due to Stavros.) Thus change (simp.lisp) (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA))) to (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA $ind $und))) Additionally, I think it would be okay to give $unknown, $pos, $neg, $zero, $pz, $nz, $pn, and $pnz the sysconst property. Now disallow assignments to sysconsts by changing mset to (mlisp.lisp) to (DEFUN MSET (X Y) (declare (object y x)) (PROG NIL (COND ((OR (NULL $SETCHECK) (EQ $SETCHECK '$SETCHECK))) ((AND (OR (ATOM $SETCHECK) (MEMALIKE X (CDR $SETCHECK)) (AND (NOT (ATOM X)) (MEMALIKE (CAAR X) (CDR $SETCHECK)))) (NOT (EQ X Y))) (DISPLA (LIST '(MTEXT) (DISP2 X) ' set to  Y)) (IF $SETCHECKBREAK (LET (($SETVAL Y)) (MERRBREAK T) (SETQ Y $SETVAL))))) (COND ((ATOM X) (WHEN (OR (NOT (SYMBOLP X)) (MEMQ X '(T NIL)) (MGET X '$NUMER) (char= (GETCHARN X 1) #\&) (get x 'sysconst)) ;; prevent assignments to system consts (IF MUNBINDP (RETURN NIL)) (IF (MGET X '$NUMER) (MERROR "~:M improper value assignment to a numerical quantity" X) (MERROR "~:M improper value assignment" X))) (LET ((F (GET X 'ASSIGN))) (IF (AND F (OR (NOT (EQ X Y)) (MEMQ F '(NEVERSET READ ONLYASSIGN)))) (IF (EQ (FUNCALL F X Y) 'MUNBINDP) (RETURN NIL)))) (COND ((AND (NOT (BOUNDP X)) (NOT DSKSETP)) (ADD2LNC X $VALUES)) ((AND (NOT (EQ X Y)) (OPTIONP X)) (IF $OPTIONSET (MTELL "~:M option is being set.~%" X)) (IF (NOT (EQ X '$LINENUM)) (ADD2LNC X $MYOPTIONS)))) (RETURN (SET X Y))) ((MEMQ 'ARRAY (CDAR X)) (RETURN (ARRSTORE X Y))) ((AND $SUBSCRMAP (MEMQ (CAAR X) '(MLIST $MATRIX))) (RETURN (OUTERMAP1 'MSET X Y))) (T (MERROR "Improper value assignment:~% ~M" X))))) After the fixes (C1) load("mset.x86f"); (D2) mset.x86f (C3) und : 13; UND improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C4) inf : 34; INF improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C5) %i : 1; %I improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) Barton  >Comment By: Raymond Toy (rtoy) Date: 20030807 11:14 Message: Logged In: YES user_id=28849 Very nice! I'll apply this shortly, with the additional symbols you mentioned.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 
From: SourceForge.net <noreply@so...>  20030812 16:12:06

Bugs item #783847, was opened at 20030805 20:35 Message generated for change (Comment added) made by macrakis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Barton Willis (willisb) Assigned to: Nobody/Anonymous (nobody) Summary: assignments to %i, inf, ... Initial Comment: Maxima allows assignments to %i, inf, ind, and und. An assignments to %i is especially troublesome (C1) %i : 42; (D1) 42 (C2) %i^2; (D2) 1764 The fix is to give $ind and $und the sysconst property. (The fix is mostly due to Stavros.) Thus change (simp.lisp) (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA))) to (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA $ind $und))) Additionally, I think it would be okay to give $unknown, $pos, $neg, $zero, $pz, $nz, $pn, and $pnz the sysconst property. Now disallow assignments to sysconsts by changing mset to (mlisp.lisp) to (DEFUN MSET (X Y) (declare (object y x)) (PROG NIL (COND ((OR (NULL $SETCHECK) (EQ $SETCHECK '$SETCHECK))) ((AND (OR (ATOM $SETCHECK) (MEMALIKE X (CDR $SETCHECK)) (AND (NOT (ATOM X)) (MEMALIKE (CAAR X) (CDR $SETCHECK)))) (NOT (EQ X Y))) (DISPLA (LIST '(MTEXT) (DISP2 X) ' set to  Y)) (IF $SETCHECKBREAK (LET (($SETVAL Y)) (MERRBREAK T) (SETQ Y $SETVAL))))) (COND ((ATOM X) (WHEN (OR (NOT (SYMBOLP X)) (MEMQ X '(T NIL)) (MGET X '$NUMER) (char= (GETCHARN X 1) #\&) (get x 'sysconst)) ;; prevent assignments to system consts (IF MUNBINDP (RETURN NIL)) (IF (MGET X '$NUMER) (MERROR "~:M improper value assignment to a numerical quantity" X) (MERROR "~:M improper value assignment" X))) (LET ((F (GET X 'ASSIGN))) (IF (AND F (OR (NOT (EQ X Y)) (MEMQ F '(NEVERSET READ ONLYASSIGN)))) (IF (EQ (FUNCALL F X Y) 'MUNBINDP) (RETURN NIL)))) (COND ((AND (NOT (BOUNDP X)) (NOT DSKSETP)) (ADD2LNC X $VALUES)) ((AND (NOT (EQ X Y)) (OPTIONP X)) (IF $OPTIONSET (MTELL "~:M option is being set.~%" X)) (IF (NOT (EQ X '$LINENUM)) (ADD2LNC X $MYOPTIONS)))) (RETURN (SET X Y))) ((MEMQ 'ARRAY (CDAR X)) (RETURN (ARRSTORE X Y))) ((AND $SUBSCRMAP (MEMQ (CAAR X) '(MLIST $MATRIX))) (RETURN (OUTERMAP1 'MSET X Y))) (T (MERROR "Improper value assignment:~% ~M" X))))) After the fixes (C1) load("mset.x86f"); (D2) mset.x86f (C3) und : 13; UND improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C4) inf : 34; INF improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C5) %i : 1; %I improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) Barton  >Comment By: Stavros Macrakis (macrakis) Date: 20030812 11:59 Message: Logged In: YES user_id=588346 I would suggest putting sysconst on T and NIL and getting rid of the separate test (memq x '(t nil)). That is more uniform  TRUE and FALSE are sysconsts like everything else. As for putting sysconst on pz, nz, pn, etc., I am not sure. If they were long and specific names (nonneg, nonpos, nonzero, etc.), I wouldn't have any problem. But twoletter names are just too useful  since subscripts like p[z] have a specific meaning in Maxima, it is common to use pz to mean things like potential sub z or whatever. Moreover, there is no good reason to be evaluating these symbols  tests should be e.g. if sign(x)='pz (though I know many people don't bother to quote). So to be uniform, I argue AGAINST making pz, nz, pz, and pnz (and for uniformity, pos and neg) into sysconsts.  Comment By: Raymond Toy (rtoy) Date: 20030807 11:14 Message: Logged In: YES user_id=28849 Very nice! I'll apply this shortly, with the additional symbols you mentioned.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 
From: SourceForge.net <noreply@so...>  20060708 18:29:57

Bugs item #783847, was opened at 20030805 18:35 Message generated for change (Comment added) made by robert_dodier You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: Lisp Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: Barton Willis (willisb) Assigned to: Nobody/Anonymous (nobody) Summary: assignments to %i, inf, ... Initial Comment: Maxima allows assignments to %i, inf, ind, and und. An assignments to %i is especially troublesome (C1) %i : 42; (D1) 42 (C2) %i^2; (D2) 1764 The fix is to give $ind and $und the sysconst property. (The fix is mostly due to Stavros.) Thus change (simp.lisp) (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA))) to (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA $ind $und))) Additionally, I think it would be okay to give $unknown, $pos, $neg, $zero, $pz, $nz, $pn, and $pnz the sysconst property. Now disallow assignments to sysconsts by changing mset to (mlisp.lisp) to (DEFUN MSET (X Y) (declare (object y x)) (PROG NIL (COND ((OR (NULL $SETCHECK) (EQ $SETCHECK '$SETCHECK))) ((AND (OR (ATOM $SETCHECK) (MEMALIKE X (CDR $SETCHECK)) (AND (NOT (ATOM X)) (MEMALIKE (CAAR X) (CDR $SETCHECK)))) (NOT (EQ X Y))) (DISPLA (LIST '(MTEXT) (DISP2 X) ' set to  Y)) (IF $SETCHECKBREAK (LET (($SETVAL Y)) (MERRBREAK T) (SETQ Y $SETVAL))))) (COND ((ATOM X) (WHEN (OR (NOT (SYMBOLP X)) (MEMQ X '(T NIL)) (MGET X '$NUMER) (char= (GETCHARN X 1) #\&) (get x 'sysconst)) ;; prevent assignments to system consts (IF MUNBINDP (RETURN NIL)) (IF (MGET X '$NUMER) (MERROR "~:M improper value assignment to a numerical quantity" X) (MERROR "~:M improper value assignment" X))) (LET ((F (GET X 'ASSIGN))) (IF (AND F (OR (NOT (EQ X Y)) (MEMQ F '(NEVERSET READ ONLYASSIGN)))) (IF (EQ (FUNCALL F X Y) 'MUNBINDP) (RETURN NIL)))) (COND ((AND (NOT (BOUNDP X)) (NOT DSKSETP)) (ADD2LNC X $VALUES)) ((AND (NOT (EQ X Y)) (OPTIONP X)) (IF $OPTIONSET (MTELL "~:M option is being set.~%" X)) (IF (NOT (EQ X '$LINENUM)) (ADD2LNC X $MYOPTIONS)))) (RETURN (SET X Y))) ((MEMQ 'ARRAY (CDAR X)) (RETURN (ARRSTORE X Y))) ((AND $SUBSCRMAP (MEMQ (CAAR X) '(MLIST $MATRIX))) (RETURN (OUTERMAP1 'MSET X Y))) (T (MERROR "Improper value assignment:~% ~M" X))))) After the fixes (C1) load("mset.x86f"); (D2) mset.x86f (C3) und : 13; UND improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C4) inf : 34; INF improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C5) %i : 1; %I improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) Barton  >Comment By: Robert Dodier (robert_dodier) Date: 20060708 12:29 Message: Logged In: YES user_id=501686 Still present in 5.9.3cvs.  Comment By: Stavros Macrakis (macrakis) Date: 20030812 09:59 Message: Logged In: YES user_id=588346 I would suggest putting sysconst on T and NIL and getting rid of the separate test (memq x '(t nil)). That is more uniform  TRUE and FALSE are sysconsts like everything else. As for putting sysconst on pz, nz, pn, etc., I am not sure. If they were long and specific names (nonneg, nonpos, nonzero, etc.), I wouldn't have any problem. But twoletter names are just too useful  since subscripts like p[z] have a specific meaning in Maxima, it is common to use pz to mean things like potential sub z or whatever. Moreover, there is no good reason to be evaluating these symbols  tests should be e.g. if sign(x)='pz (though I know many people don't bother to quote). So to be uniform, I argue AGAINST making pz, nz, pz, and pnz (and for uniformity, pos and neg) into sysconsts.  Comment By: Raymond Toy (rtoy) Date: 20030807 09:14 Message: Logged In: YES user_id=28849 Very nice! I'll apply this shortly, with the additional symbols you mentioned.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 
From: SourceForge.net <noreply@so...>  20090113 23:37:04

Bugs item #783847, was opened at 20030806 02:35 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Barton Willis (willisb) Assigned to: Nobody/Anonymous (nobody) Summary: assignments to %i, inf, ... Initial Comment: Maxima allows assignments to %i, inf, ind, and und. An assignments to %i is especially troublesome (C1) %i : 42; (D1) 42 (C2) %i^2; (D2) 1764 The fix is to give $ind and $und the sysconst property. (The fix is mostly due to Stavros.) Thus change (simp.lisp) (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA))) to (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA $ind $und))) Additionally, I think it would be okay to give $unknown, $pos, $neg, $zero, $pz, $nz, $pn, and $pnz the sysconst property. Now disallow assignments to sysconsts by changing mset to (mlisp.lisp) to (DEFUN MSET (X Y) (declare (object y x)) (PROG NIL (COND ((OR (NULL $SETCHECK) (EQ $SETCHECK '$SETCHECK))) ((AND (OR (ATOM $SETCHECK) (MEMALIKE X (CDR $SETCHECK)) (AND (NOT (ATOM X)) (MEMALIKE (CAAR X) (CDR $SETCHECK)))) (NOT (EQ X Y))) (DISPLA (LIST '(MTEXT) (DISP2 X) ' set to  Y)) (IF $SETCHECKBREAK (LET (($SETVAL Y)) (MERRBREAK T) (SETQ Y $SETVAL))))) (COND ((ATOM X) (WHEN (OR (NOT (SYMBOLP X)) (MEMQ X '(T NIL)) (MGET X '$NUMER) (char= (GETCHARN X 1) #\&) (get x 'sysconst)) ;; prevent assignments to system consts (IF MUNBINDP (RETURN NIL)) (IF (MGET X '$NUMER) (MERROR "~:M improper value assignment to a numerical quantity" X) (MERROR "~:M improper value assignment" X))) (LET ((F (GET X 'ASSIGN))) (IF (AND F (OR (NOT (EQ X Y)) (MEMQ F '(NEVERSET READ ONLYASSIGN)))) (IF (EQ (FUNCALL F X Y) 'MUNBINDP) (RETURN NIL)))) (COND ((AND (NOT (BOUNDP X)) (NOT DSKSETP)) (ADD2LNC X $VALUES)) ((AND (NOT (EQ X Y)) (OPTIONP X)) (IF $OPTIONSET (MTELL "~:M option is being set.~%" X)) (IF (NOT (EQ X '$LINENUM)) (ADD2LNC X $MYOPTIONS)))) (RETURN (SET X Y))) ((MEMQ 'ARRAY (CDAR X)) (RETURN (ARRSTORE X Y))) ((AND $SUBSCRMAP (MEMQ (CAAR X) '(MLIST $MATRIX))) (RETURN (OUTERMAP1 'MSET X Y))) (T (MERROR "Improper value assignment:~% ~M" X))))) After the fixes (C1) load("mset.x86f"); (D2) mset.x86f (C3) und : 13; UND improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C4) inf : 34; INF improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C5) %i : 1; %I improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) Barton  >Comment By: Dieter Kaiser (crategus) Date: 20090114 00:37 Message: The assignment of values to system constants (%i, %pi, ...) is still possible. The constants $inf, $minf, $und, $ind, $infinity t and nil have been given the property SYSCONST in file simp.lisp (rev.1.34, 2.4.2007). But the proposed additional check against a SYSCONST in the function mset in the file mlist.lisp has not been added. The change would be (when (or (not (symbolp x)) (member x '(t nil) :test #'eq) (mget x '$numer) (get x 'sysconst)) ; Do not allow assignment of a SYSCONST With this additional check it would be no longer possible to assign a value to a system constant and the bug report could be closed. I am wondering why this test is not added. The testsuite would have no problems Dieter Kaiser  Comment By: Robert Dodier (robert_dodier) Date: 20060708 20:29 Message: Logged In: YES user_id=501686 Still present in 5.9.3cvs.  Comment By: Stavros Macrakis (macrakis) Date: 20030812 17:59 Message: Logged In: YES user_id=588346 I would suggest putting sysconst on T and NIL and getting rid of the separate test (memq x '(t nil)). That is more uniform  TRUE and FALSE are sysconsts like everything else. As for putting sysconst on pz, nz, pn, etc., I am not sure. If they were long and specific names (nonneg, nonpos, nonzero, etc.), I wouldn't have any problem. But twoletter names are just too useful  since subscripts like p[z] have a specific meaning in Maxima, it is common to use pz to mean things like potential sub z or whatever. Moreover, there is no good reason to be evaluating these symbols  tests should be e.g. if sign(x)='pz (though I know many people don't bother to quote). So to be uniform, I argue AGAINST making pz, nz, pz, and pnz (and for uniformity, pos and neg) into sysconsts.  Comment By: Raymond Toy (rtoy) Date: 20030807 17:14 Message: Logged In: YES user_id=28849 Very nice! I'll apply this shortly, with the additional symbols you mentioned.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 
From: SourceForge.net <noreply@so...>  20090116 19:45:07

Bugs item #783847, was opened at 20030806 02:35 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Barton Willis (willisb) Assigned to: Nobody/Anonymous (nobody) Summary: assignments to %i, inf, ... Initial Comment: Maxima allows assignments to %i, inf, ind, and und. An assignments to %i is especially troublesome (C1) %i : 42; (D1) 42 (C2) %i^2; (D2) 1764 The fix is to give $ind and $und the sysconst property. (The fix is mostly due to Stavros.) Thus change (simp.lisp) (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA))) to (evalwhen (load) (MAPC #'(LAMBDA (X) (MPUTPROP X T '$CONSTANT) (PUTPROP X T 'SYSCONST)) '($%PI $%I $%E $%PHI $INF $MINF $INFINITY %I $%GAMMA $ind $und))) Additionally, I think it would be okay to give $unknown, $pos, $neg, $zero, $pz, $nz, $pn, and $pnz the sysconst property. Now disallow assignments to sysconsts by changing mset to (mlisp.lisp) to (DEFUN MSET (X Y) (declare (object y x)) (PROG NIL (COND ((OR (NULL $SETCHECK) (EQ $SETCHECK '$SETCHECK))) ((AND (OR (ATOM $SETCHECK) (MEMALIKE X (CDR $SETCHECK)) (AND (NOT (ATOM X)) (MEMALIKE (CAAR X) (CDR $SETCHECK)))) (NOT (EQ X Y))) (DISPLA (LIST '(MTEXT) (DISP2 X) ' set to  Y)) (IF $SETCHECKBREAK (LET (($SETVAL Y)) (MERRBREAK T) (SETQ Y $SETVAL))))) (COND ((ATOM X) (WHEN (OR (NOT (SYMBOLP X)) (MEMQ X '(T NIL)) (MGET X '$NUMER) (char= (GETCHARN X 1) #\&) (get x 'sysconst)) ;; prevent assignments to system consts (IF MUNBINDP (RETURN NIL)) (IF (MGET X '$NUMER) (MERROR "~:M improper value assignment to a numerical quantity" X) (MERROR "~:M improper value assignment" X))) (LET ((F (GET X 'ASSIGN))) (IF (AND F (OR (NOT (EQ X Y)) (MEMQ F '(NEVERSET READ ONLYASSIGN)))) (IF (EQ (FUNCALL F X Y) 'MUNBINDP) (RETURN NIL)))) (COND ((AND (NOT (BOUNDP X)) (NOT DSKSETP)) (ADD2LNC X $VALUES)) ((AND (NOT (EQ X Y)) (OPTIONP X)) (IF $OPTIONSET (MTELL "~:M option is being set.~%" X)) (IF (NOT (EQ X '$LINENUM)) (ADD2LNC X $MYOPTIONS)))) (RETURN (SET X Y))) ((MEMQ 'ARRAY (CDAR X)) (RETURN (ARRSTORE X Y))) ((AND $SUBSCRMAP (MEMQ (CAAR X) '(MLIST $MATRIX))) (RETURN (OUTERMAP1 'MSET X Y))) (T (MERROR "Improper value assignment:~% ~M" X))))) After the fixes (C1) load("mset.x86f"); (D2) mset.x86f (C3) und : 13; UND improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C4) inf : 34; INF improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) (C5) %i : 1; %I improper value assignment  an error. Quitting. To debug this try DEBUGMODE (TRUE);) Barton  >Comment By: Dieter Kaiser (crategus) Date: 20090116 20:44 Message: The suggested test is added. Assignment to a symbol which is declared to be a SYSCONST is prevented. Closing the bug report as fixed. Dieter Kaiser  Comment By: Dieter Kaiser (crategus) Date: 20090114 00:37 Message: The assignment of values to system constants (%i, %pi, ...) is still possible. The constants $inf, $minf, $und, $ind, $infinity t and nil have been given the property SYSCONST in file simp.lisp (rev.1.34, 2.4.2007). But the proposed additional check against a SYSCONST in the function mset in the file mlist.lisp has not been added. The change would be (when (or (not (symbolp x)) (member x '(t nil) :test #'eq) (mget x '$numer) (get x 'sysconst)) ; Do not allow assignment of a SYSCONST With this additional check it would be no longer possible to assign a value to a system constant and the bug report could be closed. I am wondering why this test is not added. The testsuite would have no problems Dieter Kaiser  Comment By: Robert Dodier (robert_dodier) Date: 20060708 20:29 Message: Logged In: YES user_id=501686 Still present in 5.9.3cvs.  Comment By: Stavros Macrakis (macrakis) Date: 20030812 17:59 Message: Logged In: YES user_id=588346 I would suggest putting sysconst on T and NIL and getting rid of the separate test (memq x '(t nil)). That is more uniform  TRUE and FALSE are sysconsts like everything else. As for putting sysconst on pz, nz, pn, etc., I am not sure. If they were long and specific names (nonneg, nonpos, nonzero, etc.), I wouldn't have any problem. But twoletter names are just too useful  since subscripts like p[z] have a specific meaning in Maxima, it is common to use pz to mean things like potential sub z or whatever. Moreover, there is no good reason to be evaluating these symbols  tests should be e.g. if sign(x)='pz (though I know many people don't bother to quote). So to be uniform, I argue AGAINST making pz, nz, pz, and pnz (and for uniformity, pos and neg) into sysconsts.  Comment By: Raymond Toy (rtoy) Date: 20030807 17:14 Message: Logged In: YES user_id=28849 Very nice! I'll apply this shortly, with the additional symbols you mentioned.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=783847&group_id=4933 