From: <cli...@li...> - 2007-11-25 20:07:01
|
Send clisp-cvs mailing list submissions to cli...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/clisp-cvs or, via email, send a message with subject or body 'help' to cli...@li... You can reach the person managing the list at cli...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of clisp-cvs digest..." CLISP CVS commits for today Today's Topics: 1. clisp/doc mop.xml,2.76,2.77 (Sam Steingold) 2. clisp/tests mop.tst,1.61,1.62 ChangeLog,1.520,1.521 (Sam Steingold) ---------------------------------------------------------------------- Message: 1 Date: Sun, 25 Nov 2007 16:56:04 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/doc mop.xml,2.76,2.77 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7271/doc Modified Files: mop.xml Log Message: (mop-clisp-warn): make the code cut-and-pasteable Index: mop.xml =================================================================== RCS file: /cvsroot/clisp/clisp/doc/mop.xml,v retrieving revision 2.76 retrieving revision 2.77 diff -u -d -r2.76 -r2.77 --- mop.xml 23 Nov 2007 20:09:36 -0000 2.76 +++ mop.xml 25 Nov 2007 16:56:02 -0000 2.77 @@ -5414,9 +5414,11 @@ <para>When &clisp; encounters suspicious &clos; code, it issues a &warning-t; of type <classname>CLOS:CLOS-WARNING</classname>. - Use &set-global-handler; with &muffle-warning; on the appropriate - &warning-t; type to suppress the undesired warnings (¬-e; - recommended!)</para> + To suppress the undesired warnings (¬-e; recommended!) use + &set-global-handler; with &muffle-warning; on the appropriate + &warning-t; type;. + To find where the warnings come from (recommended), set + &break-on-signals-var; to the appropriate &warning-t; type.</para> <section id="mop-clisp-gf-already-called-warning"><title>Warning <classname>CLOS:GF-ALREADY-CALLED-WARNING</classname></title> @@ -5425,18 +5427,16 @@ (order of definitions, order of macro expansions, or similar) is wrong. Example:<programlisting id="mop-clisp-gf-already-called-warning-code" language="lisp"> -(defclass ware () ()) +(defclass ware () ((title :initarg :title :accessor title))) (defclass book (ware) ()) (defclass compact-disk (ware) ()) (defclass dvd (ware) ()) (defgeneric add-to-inventory (object)) (defmethod add-to-inventory ((object ware)) nil) -(defvar *bible* (make-instance 'book)) -(add-to-inventory *bible*) +(add-to-inventory (make-instance 'book :title "CLtL1")) (defvar *book-counter* 0) (defmethod add-to-inventory ((object book)) (incf *book-counter*)) -(defvar *harry-potter-7* (make-instance 'book)) -(add-to-inventory *harry-potter-7*) +(add-to-inventory (make-instance 'book :title "CLtL2")) *book-counter* <computeroutput>1</computeroutput> </programlisting> @@ -5475,13 +5475,14 @@ Example: in addition to the code <link linkend="mop-clisp-gf-already-called-warning-code">above</link>: <programlisting language="lisp"> -(defgeneric sell (object price)) -(defvar *book-sales-statistics* (make-hash-table)) +(defvar *book-sales-statistics* (make-hash-table :test 'equal)) (defmethod add-to-inventory ((object book)) - (let ((stat (gethash (book-title book) *book-sales-statistics*))) - (unless stat (setf stat (make-stat))) - (stat-add stat 1 price) - (setf (gethash (book-title book) *book-sales-statistics*) stat))) + (setf (gethash (title object) sale-stats) (cons 0 0))) +(add-to-inventory (make-instance 'book :title "AMOP")) +*book-counter* +<computeroutput>1</computeroutput> +*book-sales-statistics* +<computeroutput>#S(HASH-TABLE :TEST FASTHASH-EQUAL ("AMOP" . (0 . 0)))</computeroutput> </programlisting> The programmer who programmed the first <literal role="method"><function>add-to-inventory</function>@<classname>book</classname></literal> ------------------------------ Message: 2 Date: Sun, 25 Nov 2007 16:57:16 +0000 From: Sam Steingold <sd...@us...> Subject: clisp/tests mop.tst,1.61,1.62 ChangeLog,1.520,1.521 To: cli...@li... Message-ID: <E1I...@ma...> Update of /cvsroot/clisp/clisp/tests In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8002/tests Modified Files: mop.tst ChangeLog Log Message: add a test for http://clisp.cons.org/impnotes/mop-clisp.html#mop-clisp-warn Index: mop.tst =================================================================== RCS file: /cvsroot/clisp/clisp/tests/mop.tst,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- mop.tst 30 Sep 2007 05:32:43 -0000 1.61 +++ mop.tst 25 Nov 2007 16:57:14 -0000 1.62 @@ -3289,9 +3289,33 @@ t) T +;; http://clisp.cons.org/impnotes/mop-clisp.html#mop-clisp-warn +(let ((book-counter 0) (sale-stats (make-hash-table :test 'equal)) + (already-called 0) (replacing-method 0)) + (defmethod initialize-instance :after ((o clos:gf-already-called-warning) &rest opts) (incf already-called)) + (defmethod initialize-instance :after ((o clos:gf-replacing-method-warning) &rest opts) (incf replacing-method)) + (defclass ware () ((title :initarg :title :accessor title))) + (defclass book (ware) ()) + (defclass compact-disk (ware) ()) + (defclass dvd (ware) ()) + (defgeneric add-to-inventory (object)) + (defmethod add-to-inventory ((object ware)) nil) + (add-to-inventory (make-instance 'book :title "CLtL1")) + (defmethod add-to-inventory ((object book)) (incf book-counter)) + (add-to-inventory (make-instance 'book :title "CLtL2")) + (defmethod add-to-inventory ((object book)) + (setf (gethash (title object) sale-stats) (cons 0 0))) + (add-to-inventory (make-instance 'book :title "AMOP")) + (list book-counter (hash-table-count sale-stats) + already-called replacing-method)) +(1 1 2 1) ;; cleanup (setf (find-class 'class-bad-slot) nil + (find-class 'ware) nil + (find-class 'book) nil + (find-class 'compact-disk) nil + (find-class 'dvd) nil (find-class 'constructor) nil (find-class 'person) nil (find-class 'counted1-class) nil Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/tests/ChangeLog,v retrieving revision 1.520 retrieving revision 1.521 diff -u -d -r1.520 -r1.521 --- ChangeLog 21 Nov 2007 21:28:48 -0000 1.520 +++ ChangeLog 25 Nov 2007 16:57:14 -0000 1.521 @@ -1,3 +1,8 @@ +2007-11-25 Sam Steingold <sd...@gn...> + + * mop.tst: add a test for + http://clisp.cons.org/impnotes/mop-clisp.html#mop-clisp-warn + 2007-11-21 Sam Steingold <sd...@gn...> * iofkts.tst: add a test for bug #[ 1835520 ]: ------------------------------ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ------------------------------ _______________________________________________ clisp-cvs mailing list cli...@li... https://lists.sourceforge.net/lists/listinfo/clisp-cvs End of clisp-cvs Digest, Vol 19, Issue 36 ***************************************** |