[cldoc-devel] use of format and intern in function generating macros

Iban Hatchondo hatchond at free.fr
Mon Jul 17 14:34:06 UTC 2006


As mentioned by Joshua,
I miss the pacakge argument in mk-fname. To handle it I would be tempted 
  to suggest this:

(defun cludg-mksym (&rest parts)
    "Returns a symbol name made from the concatenation of the given parts."
    (apply #'concatenate 'string (mapcar #'string parts)))


(defun mk-fname (s1 s2 &aux (pkg (find-package-caseless *current-package*)))
   (with-standard-io-syntax (intern (cludg-mksym s1 s2) pkg)))

and replace other intern forms by (intern (cludg-mksym ...))


Iban Hatchondo wrote:
> Hi all,
> 
> Thanks for reporting the bug.
> 
> What about generalizing your solution and define something like:
> 
>  (defun cludg-intern (&rest parts)
>    "Returns an interned symbol made from the concatenation of the given 
> parts."
>    (intern (apply #'concatenate 'string (mapcar #'string parts))))
> 
> that we would use instead of the those, three at least, (intern (format 
> ..)) forms ?
> 
> Joshua, can you confirm this fix the problem using your all favorite 
> settings ?
> 
> 
> Kind regards,
> Iban.
> 
> 
> Taylor, Joshua wrote:
> 
>> Hello CLDOC list,
>>
>> I've just recently checked out a copy CLDOC, and am quite pleased with 
>> the
>> results I'm getting. At first, however, I was running into a slight
>> bug, but one which
>> is easy to fix.
>>
>> In several places in the code:
>>
>> cludg.lisp:186:       (defun ,(intern (format nil "~a" s-purger)) 
>> (string)
>> cludg.lisp:191:       (defun ,(intern (format nil "~a" ll-purger)) 
>> (lambda-list)
>> cludg.lisp:618:  (with-standard-io-syntax (intern (format nil "~a~a"
>> s1 s2) pkg)))
>>
>> intern is being called with a string coming from format. In most Lisps
>> this is not
>> a problem, and in the one I use (Lispworks) the default settings would 
>> have no
>> problem either. Out of personal preference however, I set *print-case* to
>> :capitalize, which means that, e.g.,  (format nil "~a" s-purger) would 
>> give me
>> "Purge-String-For-Html" and that the function defined was actually
>> cldoc:|Purge-String-For-Html|.
>>
>> Fortunately the fix is easy: just change instances of (format nil "~a" 
>> sym) tp
>> (symbol-name s-sym), and
>> cludg.lisp:618:  (with-standard-io-syntax (intern (format nil "~a~a"
>> s1 s2) pkg)))
>> to
>> cludg.lisp:618:  (with-standard-io-syntax (intern (concatenate 'string
>> (symbol-name s1) (symbol-name s2)) pkg)))
>> although I'm not sure if it's necessary in that second case (as I
>> don't know the context
>> of that code).
>>
>> Once I got those purgers working, the HTML documentation is really 
>> beautiful.
>> I'm very impressed with the project. Thanks for all your hard work!
> 
> 
> 
>     
> 
>     
>        
> ___________________________________________________________________________ 
> Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son 
> interface révolutionnaire.
> http://fr.mail.yahoo.com
> _______________________________________________
> cldoc-devel mailing list
> cldoc-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cldoc-devel
> 
> 


	

	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com



More information about the cldoc-devel mailing list