<div dir="ltr"><div dir="ltr"><div><br></div><div>parenscript does not redefine "defun", it imports cl:defun and exports it again.</div><div><span style="font-family:courier new,monospace"><br></span></div><div><span style="font-family:courier new,monospace">CL-USER> (eq 'ps:defun 'cl:defun )<br>T</span></div><div><br></div><div>Exporting has nothing to do with the package lock. it refers to when you try to redefine cl:defun.</div><div><br></div><div>You can define your own <span style="font-family:courier new,monospace">defun</span> in your own package. The library <i>Series </i>does this but it does not export it.<br></div><div><br></div><div>from s-package.lisp</div><div><span style="font-family:courier new,monospace"><br></span></div><div><span style="font-family:courier new,monospace">(defpackage #:series<br> (:use #:cl)<br> (:export <br> ...<br> )<br> <br> (:shadow<br> #:let #:let* #:multiple-value-bind #:funcall #:defun<br> #+(or cmu scl) #:collect #+(or cmu scl) #:iterate)<br> ....<br>)</span></div><div><br></div><div>from s-code.lisp:</div><div><span style="font-family:courier new,monospace"><br></span></div><div><span style="font-family:courier new,monospace">;; EXTENSION<br>(defmacro defun (name lambda-list &environment *env* &body body)<br> (if (dolist (form body)<br> (cond ((and (stringp form) (eq form (car body))))<br> ((and (consp form) (eq-car form 'declare))<br> (if (assoc 'optimizable-series-function (cdr form)) (return t)))<br> (t (return nil))))<br> (define-optimizable-series-fn name lambda-list body)<br> (progn (undefine-optimizable-series-fn name)<br> `(cl:defun ,name ,lambda-list<br> . ,body))))</span></div><div><br></div><div>you could export it, put it would generate conflicts when you use it.</div><div><br></div><div>SERIES> (export 'defun)<br>T<br>SERIES> (in-package :cl-user)<br>#<PACKAGE "COMMON-LISP-USER"><br>CL-USER> (use-package :series)</div><div></div><div style="margin-left:40px">USE-PACKAGE #<PACKAGE "SERIES"> causes name-conflicts in<br>#<PACKAGE "COMMON-LISP-USER"> between the following symbols:<br> SERIES:DEFUN, COMMON-LISP:DEFUN<br> [Condition of type NAME-CONFLICT]<br>See also:<br> Common Lisp Hyperspec, 11.1.1.2.5 [:section]</div><div>; Evaluation aborted on #<NAME-CONFLICT {1002576393}>.<br>CL-USER> </div></div><div><br></div><div>I hope this clarifies it for you.</div><div><br></div><div>andy peterson</div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 9 Jun 2019 at 15:39, James Gunn <<a href="mailto:jgunn987@gmail.com">jgunn987@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I have been reading the source code for parenscript and I am keen to find out how you override locked symbols? In the parenscript package there are exports such as "#:defun". I have tried myself to create my own package that exports defun but i get the following error message(using SBCL)<br><br></div><div>"Lock on package COMMON-LISP violated when proclaiming DEFUN as a function"<br><br>I'd be very interested in finding out how you got around this.<br><br>Thank you,</div><div><br></div><div>James Gunn</div></div>
</blockquote></div></div>