[cl-who-devel] Exposing String Escape Functions
Volkan YAZICI
yazicivo at ttnet.net.tr
Mon Jul 16 13:35:40 UTC 2007
Edi Weitz <edi at agharta.de> writes:
> On Mon, 16 Jul 2007 14:29:26 +0300, Volkan YAZICI <yazicivo at ttnet.net.tr> wrote:
>> (write-string
>> (cl-who:escape-string (make-string 1 :initial-element c))
>> some-output-stream)
>
> OK, I see.
>
> It's fine with me if you want to isolate the corresponding code and
> export a function which works on characters as long as your patch
> adheres with these guidelines:
>
> http://weitz.de/patches.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cl-who-escape-char.patch
Type: text/x-diff
Size: 4757 bytes
Desc: CL-WHO ESCAPE-CHAR Patch
URL: <https://mailman.common-lisp.net/pipermail/cl-who-devel/attachments/20070716/dfa3c5be/attachment.patch>
-------------- next part --------------
I attached the related patch with the post. But if you'd ask for my
opinion, escaping functions are just polluting function namespace.
IMHO, it would be better to collect them under a single generic
function. (Also by preserving old ones for compatibility.) For
instance:
(defmethod escape ((input character) &optional test) ...)
(defmethod escape ((input string) &optional text) ...)
And then we just supply the related escape predicates as global
variables. (This time we pollute variable namespace.) Another,
suggestion:
(defmethod escape ((type (eql :ascii)) (input character)) ...)
(defmethod escape ((type (eql :ascii)) (input string)) ...)
(defmethod escape ((type (eql :minimal)) ...) ...)
...
By the way, (eq *html-node* :xml) checks in the code make FORMAT
optimization impossible for character escaping routines. I didn't test
the impact of this from the performance point of view, but how many
clients there are that doesn't support hexadecimals in the escaped
entities? (Maybe let that check as a compile time parameter?)
Anyway, I'm just thinking loudly and sure you'll conclude to the best.
Regards.
More information about the Cl-who-devel
mailing list