On 5/23/16, 2:29 PM, "Rich Hickey" <[email protected] on behalf of
[email protected]> wrote:
>fdef will not add doc metadata (see rationale re: not putting more stuff in
>the namespaces/vars), but specs will be present when you call ‘doc’. That doc
>enhancement was in a push later in the afternoon.
Nice:
(require '[clojure.spec :as s])
(s/fdef clojure.core/symbol
:args (s/alt :separate (s/cat :ns string? :n string?)
:str string?
:sym symbol?)
:ret symbol?)
(doc symbol)
-------------------------
clojure.core/symbol
([name] [ns name])
Returns a Symbol with the given namespace and name.
Spec
args: (alt :separate (cat :ns string? :n string?) :str string? :sym symbol?)
ret: symbol?
Looks like a small bug in explain tho’ – is it worth filing a JIRA bug yet or
wait until the Alpha?
(s/instrument-all)
(symbol 1) ;; this is fine…
clojure.lang.ExceptionInfo: Call to #'clojure.core/symbol did not conform to
spec:
At: [:args :separate :ns] val: 1 fails predicate:
string?
At: [:args :str] val: 1 fails predicate: string?
At: [:args :sym] val: 1 fails predicate: symbol?
:clojure.spec/args (1)
(symbol "a" :a) ;; this should explain that :a fails predicate: string?
java.lang.IllegalArgumentException: No matching clause: :clojure.spec/accept
clojure.spec/op-explain/invokeStatic spec.clj:
1196
clojure.spec/op-explain/fn spec.clj:
1192
clojure.core/map/fn core.clj:
2657
...
clojure.core/apply/invokeStatic core.clj:
646
clojure.spec/op-explain/invokeStatic spec.clj:
1196
clojure.spec/re-explain/invokeStatic spec.clj:
1259
clojure.spec/regex-spec-impl/reify/explain* spec.clj:
1282
clojure.spec/explain-data*/invokeStatic spec.clj:
143
clojure.spec/spec-checking-fn/conform! spec.clj:
520
clojure.spec/spec-checking-fn/fn spec.clj:
532
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.