<div dir="ltr">replace with-package by the following:<div><br></div><div><div>(defmacro with-package ((&rest names) &body body)</div><div>  (let ((r (gensym)) (e (gensym)))</div><div>    `(progn</div><div>       (use ,@names)</div>
<div>       (multiple-value-bind (,r ,e)</div><div>           (ignore-errors</div><div>             (multiple-value-list</div><div>              (eval (read-from-string</div><div>                     (format nil "(progn ~{~S ~})"</div>
<div>                             (let ((*readtable* (copy-readtable)))</div><div>                               (set-macro-character #\(</div><div>                                                    (lambda (stream char)</div>
<div>                                                      (declare (ignore char))</div><div>                                                      (set-macro-character #\" nil)</div><div>                                                      (let ((str "") (n 0) (within-string nil) (pc nil))</div>
<div>                                                        (do ((c (read-char stream t nil t) (read-char stream t nil t)))</div><div>                                                            ((and (= n 0) (eq c #\))))</div>
<div>                                                          (if (not within-string)</div><div>                                                              (if (eq c #\()</div><div>                                                                  (incf n)</div>
<div>                                                                  (if (eq c #\))</div><div>                                                                      (decf n))))</div><div>                                                          (if (and (not (eq pc #\\)) (eq c #\"))</div>
<div>                                                              (progn</div><div>                                                                (setf within-string (not within-string))</div><div>                                                                (setf str (format nil "~A\"" str)))</div>
<div>                                                              (setf str (format nil "~A~A" str c)))</div><div>                                                          (setf pc c))</div><div>                                                        str)))</div>
<div>                               ',body))))))</div><div>         (unuse ,@(reverse names))</div><div>         (if (null ,e)</div><div>             (values-list ,r)</div><div>             (error (format nil "~S" ,e)))))))</div>
</div><div><br></div><div><br></div><div><div>? (with-package (calculus) (print "-:(") (print "success\"full"))</div><div><br></div><div>"-:("</div><div>"success\"full"</div>
<div>"success\"full"</div><div>? </div><div>-</div></div><div><br></div><div>Regards</div><div><br></div><div>Taoufik</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 12, 2013 at 11:59 PM, Pascal J. Bourguignon <span dir="ltr"><<a href="mailto:pjb@informatimago.com" target="_blank">pjb@informatimago.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Taoufik Dachraoui <<a href="mailto:dachraoui.taoufik@gmail.com">dachraoui.taoufik@gmail.com</a>> writes:<br>

<br>
> I managed to write a correct version of with-package macro, this is<br>
> due to the valuable hints and discussions, I learned a lot by being a<br>
> member of ccl thank you a lot for all your helps<br>
><br>
> here is the whole code of the mb simple file system (some bugs may be<br>
> found sorry i did not test thoroughly)<br>
><br>
> Now I would like to see why this design is wrong by showing me<br>
> examples where the system can fail<br>
<br>
<br>
</div>    cl-user> (mb:with-package (MB)<br>
              (print ":-(")<br>
              (print "fails badly"))<br>
<br>
    > Debug: #<end-of-file #x302001D88FAD><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
__Pascal Bourguignon__                     <a href="http://www.informatimago.com/" target="_blank">http://www.informatimago.com/</a><br>
A bad day in () is better than a good day in {}.<br>
<br>
_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
<a href="http://clozure.com/mailman/listinfo/openmcl-devel" target="_blank">http://clozure.com/mailman/listinfo/openmcl-devel</a><br>
</div></div></blockquote></div><br></div>