Edi Weitz edi@agharta.de writes:
On Mon, 16 Jul 2007 14:29:26 +0300, Volkan YAZICI yazicivo@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:
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.