[quiz] Enhanced Strings in CL ?

Pascal Bourguignon pjb at informatimago.com
Wed Nov 29 22:23:01 UTC 2006


Laurent PETIT writes:
> Hello,
> 
> I've modified the code as follows (also not yet corrected the tilde bug) :
> What you can see is that insted of restoring the full initial readtable, I
> only restore the #\" macro character previous function (the one I have
> overriden with (start). This way, I do not reset other -possible-
> personalized macro character functions.
> I also provide a (stop) method which restores the previous #\" macro
> character.
> 
> I also twiked the main function in order to let the initial string unchanged
> in case no ${} is used (usefull for a lot of macros that only accept raw
> strings, such as defpackage, ...).
> 
> Please let me know if you think this would not work in a case I haven't
> seen.

Well, what hasn't been explicitely mentionned, is that any usage of a
string where it's _not_ evaluated (which may be a lot, including the
macros), wouldn't work anymore.

What if I want to name my package: "PACK${1}"  ?


Macros can expand strings given as argument as (quote "string")
instead of merely "string".


Compare the two results:

   (let ((x 1)) (values (quote "STR ${x}") "STR ${x}"))

That's why cl-interpolate doesn't use the standard macro character,
because we want to be able to write both true _literal_ string and
interpolated strings.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"What is this talk of "release"?  Klingons do not make software
"releases".  Our software "escapes" leaving a bloody trail of
designers and quality assurance people in its wake."



More information about the Quiz mailing list