The double colon keyword creates a namespaced keyword and is perfectly 
valid syntax. It's just not used that often :) 

By default a keyword like ::test resolves to the current namespace like 
::current-ns/test, but you can also provide another ns which causes the 
problem when reading.

Have at look 
at 
https://github.com/clojure/core.logic/blob/0d1d545f0a81c585c7449aecb5d661120f3da568/src/main/clojure/clojure/core/logic/fd.clj
 
for instance.

On Wednesday, September 18, 2013 1:05:01 AM UTC+2, daveray wrote:
>
> Hey,
>
> You have too many colons:
>
> user=> (read-string ":l/test")
> :l/test
>
>
> Dave
>
>
>
> On Tue, Sep 17, 2013 at 4:03 PM, Casper Clausen <cas...@gmail.com<javascript:>
> > wrote:
>
>> I am reading a bunch of clojure files using the build-in reader (or 
>> tools.reader, it has the same problem) and I am running into a problem 
>> regarding namespaced keywords (is that the right term?) such as ::l/test.
>>
>> => (read-string "::l/test")
>> RuntimeException Invalid token: ::l/test 
>>  clojure.lang.Util.runtimeException (Util.java:219)
>>
>> It seems that the reader requires the namespace alias 'l' to exist. This 
>> is a shame because in most (all?) other respects the reader is able to just 
>> read in the symbols even if their namespace is not loaded. So in order for 
>> me to read a file with a namespaced keyword I need to eval at least the ns 
>> form of the file, which then requires me to eval the ns forms of its 
>> dependencies (and so on). My code is basically building on the excellent 
>> codeq analyzer (
>> https://github.com/Datomic/codeq/blob/master/src/datomic/codeq/analyzers/clj.clj),
>>  
>> so I am guessing this would have the same problem when running into a 
>> similar namespaced keyword.
>>
>> So my question is how do I best get around this?
>>
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to