On 18.03.2009, at 19:03, Konrad Hinsen wrote: > Why is user// an invalid token, whereas clojure.core// works > perfectly well?
I found out in the meantime that clojure.core// is indeed handled as a special case by the reader (line 276 in LispReader.java), but that still doesn't answer the question "why". It is clear that the unqualified part of a symbol can contain a slash only at the beginning, as otherwise it could be taken for a qualified symbol. But I don't see a problem with any of the following: / (unqualified /) // (unqualified //) user// (/ in namespace user) /foo (unqualified /foo) user//foo (/foo in namespace user) But the reader allows only / and clojure.core// as special cases. Is this just a limitation of the current implementation, or is there a more fundamental reason? A workaround I found is to create the symbol on the fly with a macro: (defmacro qsym [ns sym] (symbol (str ns) (str sym))) That makes it possible to refer to user// as (qsym user /), except where the symbol would be an argument to another macro, in which case there seems to be no way around defining a specialized version of that macro, e.g. (defmacro defmethod* [ns name & args] (let [qsym (symbol (str ns) (str name))] (prn qsym) `(defmethod ~qsym ~...@args))) Konrad. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---