Fork me on GitHub
#clojure-spec
<
2016-11-12
>
wei17:11:43

is there documentation for the new namespaced maps creation/destructuring features?

wei18:11:07

working out how to use fully-qualified keys in our maps to work with spec, without making our code too verbose. how would I create an alias for keyword namespaces without requiring the namespace like (require [foo.bar :as foo])? sometimes it’s impossible to require a certain namespace because of circular dependencies, but I'd still like to use an alias for creating keywords. also is there a valid syntax for referring to the current namespace in the new namespaced map syntax, something like #::{:a 1 :b 2}?

wei19:11:44

also when I eval this on the repl I get RuntimeException EOF while reading and then RuntimeException Unmatched delimiter: } :

(def a #:test{:a 1
              :b 1})

wei19:11:52

while this works

(def b #:test{:a 1 :b 1})

Alex Miller (Clojure team)19:11:40

You can use create-ns and alias to create an alias

Alex Miller (Clojure team)19:11:13

The #:: syntax should work for current ns

Alex Miller (Clojure team)19:11:04

Not sure on the reader eof - which repl are you using

wei20:11:43

thanks for the reply @alexmiller. using lein repl on 1.9-alpha14

wei20:11:31

#:: not working for me in some cases

foo.bar=> #::{:a 1}

RuntimeException EOF while reading, starting at line 1  clojure.lang.Util.runtimeException (Util.java:221)

RuntimeException Unmatched delimiter: }  clojure.lang.Util.runtimeException (Util.java:221)

gfredericks20:11:16

feels like a bug to me

sophiago20:11:43

um, is there a reason i could be getting a file not found exception for clojure/spec__init.class and clojure/spec.clj after switching to the 1.90-alpha14? i ran lein deps and even downloaded the zip in case that was necessary. do i need to run lein install in the 1.9 folder? i thought lein would have handled that

wei20:11:40

@sophiago try lean clean first. if you’re still having problems, could you try including spec in a new project as a sanity check?

sophiago20:11:40

oh you know what

sophiago20:11:02

i'm running it from a checkout dependency. so probably need to run lein install in the original directory

sophiago20:11:35

hmm, ok. lein install seems to have worked, but still getting that error in the other project

sophiago20:11:42

i'll try to clean it

sophiago20:11:53

oh, i guess i probably just need matching versions of clojure in both? that makes sense

gfredericks20:11:16

you can only have one version of clojure at a time

gfredericks20:11:43

they don't have to match, but the dependent will use the depender's version

sophiago20:11:16

ah so that should explain it

sophiago20:11:35

ok, all good. back to bug i'm getting started with spec to flush out 🙂

sophiago20:11:53

should have been able to think through that without talking out loud, but it's been a long week

sophiago20:11:02

protest marching outside my door rn...