<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 1 Aug 2017, at 17:08, Sam Steingold <<a href="mailto:sds@gnu.org" class="">sds@gnu.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">* Faré <<a href="mailto:snuerr@tznvy.pbz" class="">snuerr@tznvy.pbz</a>> [2017-08-01 10:07:33 -0400]:<br class=""><br class=""><blockquote type="cite" class="">To mark a generic function as user-extendable, one can now use a<br class="">declaration:<br class=""><br class="">--8<---------------cut here---------------start------------->8---<br class="">(defgeneric perform (...)<br class=""> (declare #+clisp (dynamically-modifiable))<br class=""> ...)<br class="">(defgeneric operation-done-p (...)<br class=""> (declare #+clisp (dynamically-modifiable))<br class=""> ...)<br class="">--8<---------------cut here---------------end--------------->8---<br class=""><br class="">The declaration is now in `hg tip` (but has not been released yet).<br class=""><br class=""></blockquote>Will that declaration cause a warning or error on older versions of<br class="">clisp? If yes, what read-time conditional more precise than #+clisp<br class="">can I use to only enable on recent enough versions of clisp?<br class=""></blockquote><br class="">My first reaction was<br class=""><br class="">--8<---------------cut here---------------start------------->8---<br class="">(declaim (declaration dynamically-modifiable))<br class="">--8<---------------cut here---------------end--------------->8---<br class=""><br class="">but for some reason it does not work with defgeneric.<br class="">Sorry.<br class=""></div></div></blockquote></div><div class=""><br class=""></div><div class=""><br class=""></div>1- when naming an implementation-specific declaration, we need to know what package it comes from!<div class=""> (Now, an implementation could use only the symbol-name of the declaration so it would accept with the same semantics any package, but this would be a problem if the program uses the same symbol name in a different package to mean something else, so I would advise implementations to avoid using symbol-names for declarations, and instead to specify a specific package).</div><div class=""><br class=""></div><div class="">2- indeed the correct way to use implementation specific declarations is to declaim them.</div><div class=""><br class=""></div><div class=""> #-clisp (defpackage “EXT” #| be careful with those <span style="font-family: 'Apple Color Emoji'; font-size: 28px;" class="">💣</span><span style="font-family: 'Apple Color Emoji'; font-size: 28px;" class="">🔪</span><span style="font-family: 'Apple Color Emoji'; font-size: 28px;" class="">🔫 </span>smart quotes! |#</div><div class=""> (:use)</div><div class=""> (:export “DYNAMICALLY-MODIFIABLE”))</div><div class=""><br class=""></div><div class=""> (declaim (declaration ext:dynamically-modifiable))</div><div class=""><br class=""></div><div class=""> (defgeneric foo (bar)</div><div class=""> (declare ext:dynamically-modifiable)))</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">It works perfectly, but on clisp, since DYNAMICALLY-MODIFIABLE doesn’t come from EXT. </div><div class="">Where does it come from???</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">[pjb@despina :0.0 ~]$ clall '(compile-file "/tmp/d.lisp")'</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Armed Bear Common Lisp:</div><div class="">========================================================================</div><div class="">Implementation: Armed Bear Common Lisp 1.4.0</div><div class=""> on Mac OS X 10.12.6</div><div class=""> on X86_64 NIL (despina.home)</div><div class=""><br class=""></div><div class="">Reading of: "(compile-file \"/tmp/d.lisp\")"</div><div class="">signaled no error</div><div class=""><br class=""></div><div class="">Evaluation of: (COMPILE-FILE "/tmp/d.lisp")</div><div class="">signaled the following error:</div><div class=""> #<READER-ERROR {2D87B142}></div><div class=""> The symbol "DYNAMICALLY-MODIFIABLE" was not found in package EXT.</div><div class="">wrote nothing on *ERROR-OUTPUT*</div><div class="">wrote nothing on *TRACE-OUTPUT*</div><div class="">wrote the following *STANDARD-OUTPUT* (lines excluded):</div><div class="">------------------------------------------------------------------------</div><div class="">; Compiling /private/tmp/d.lisp ...</div><div class="">; (DEFPACKAGE "EXT" ...)</div><div class="">------------------------------------------------------------------------</div><div class="">returned no value</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Clozure Common Lisp:</div><div class="">--> #P"/private/tmp/d.dx64fsl", NIL, NIL</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">CLISP:</div><div class="">========================================================================</div><div class="">Implementation: CLISP 2.49 (2010-07-07) (built 3704439585) (memory 3704439775)</div><div class=""> on </div><div class="">/usr/bin/clang -arch x86_64 -pipe -Wl,-no_pie -arch x86_64 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -O -DUNIX_BINARY_DISTRIB -DENABLE_UNICODE -DDYNAMIC_MODULES -I. -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -lintl -Wl,-framework -Wl,CoreFoundation -lreadline -lncurses -liconv -L/opt/local/lib -lsigsegv libgnu_cl.a -L/opt/local/lib</div><div class="">SAFETY=0 HEAPCODES STANDARD_HEAPCODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY</div><div class="">libsigsegv 2.11</div><div class="">libiconv 1.15</div><div class="">libreadline 7.0 GNU C 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)</div><div class=""> on X86_64 X86_64 (despina.home [192.168.7.10])</div><div class=""><br class=""></div><div class="">Reading of: "(compile-file \"/tmp/d.lisp\")"</div><div class="">signaled no error</div><div class=""><br class=""></div><div class="">Evaluation of: (COMPILE-FILE "/tmp/d.lisp")</div><div class="">signaled the following error:</div><div class=""> #<SYSTEM::SIMPLE-PACKAGE-ERROR #x000000020023FE91></div><div class=""> </div><div class="">READ from #<CLOSED INPUT BUFFERED FILE-STREAM CHARACTER #P"/tmp/d.lisp" @5>: #<PACKAGE</div><div class=""> EXT> has no external symbol with name "DYNAMICALLY-MODIFIABLE"</div><div class=""><br class=""></div><div class="">wrote the following *ERROR-OUTPUT* (lines excluded):</div><div class="">------------------------------------------------------------------------</div><div class="">0 errors, 0 warnings</div><div class="">------------------------------------------------------------------------</div><div class="">wrote nothing on *TRACE-OUTPUT*</div><div class="">wrote the following *STANDARD-OUTPUT* (lines excluded):</div><div class="">------------------------------------------------------------------------</div><div class="">;; Compiling file /tmp/d.lisp ...</div><div class="">------------------------------------------------------------------------</div><div class="">returned no value</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">ECL:</div><div class="">========================================================================</div><div class="">Implementation: ECL 16.1.2</div><div class=""> on Darwin 16.7.0</div><div class=""> on x86_64 NIL (despina.home)</div><div class=""><br class=""></div><div class="">Reading of: "(compile-file \"/tmp/d.lisp\")"</div><div class="">signaled no error</div><div class=""><br class=""></div><div class="">Evaluation of: (COMPILE-FILE "/tmp/d.lisp")</div><div class="">signaled the following error:</div><div class=""> #<a C:COMPILER-NOTE></div><div class=""> Note:</div><div class=""> Invoking external command:</div><div class=""> gcc -I. -I/usr/local/include/ -g -O2 -fPIC -fno-common -D_THREAD_SAFE -Ddarwin -O2 -c /private/tmp/d.c -o /private/tmp/d.o </div><div class="">wrote nothing on *ERROR-OUTPUT*</div><div class="">wrote nothing on *TRACE-OUTPUT*</div><div class="">wrote the following *STANDARD-OUTPUT* (lines excluded):</div><div class="">------------------------------------------------------------------------</div><div class="">;;; Loading #P"/usr/local/lib/ecl-16.1.2/cmp.fas"</div><div class="">;;;</div><div class="">;;; Compiling /tmp/d.lisp.</div><div class="">;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0</div><div class="">;;;</div><div class="">;;; Compiling (DEFGENERIC FOO ...).</div><div class="">;;; End of Pass 1.</div><div class="">------------------------------------------------------------------------</div><div class="">returned no value</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">SBCL:; compiling file "/private/tmp/d.lisp" (written 01 AUG 2017 05:19:58 PM):</div><div class="">; compiling (DEFPACKAGE "EXT" ...)</div><div class="">; compiling (DECLAIM (DECLARATION EXT:DYNAMICALLY-MODIFIABLE))</div><div class="">; compiling (DEFGENERIC FOO ...)</div><div class=""><br class=""></div><div class="">; /tmp/d.fasl written</div><div class="">; compilation finished in 0:00:00.003</div><div class="">--> #P"/private/tmp/d.fasl", T, T</div><div class=""><br class=""></div><div class="">========================================================================</div><div class=""><br class=""></div><div class="">[pjb@despina :0.0 ~]$ </div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">-- <br class="">__Pascal J. Bourguignon__<br class=""><br class=""><br class=""></div></div>
</div>
<br class=""></div></body></html>