This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-08
Channels
- # admin-announcements (3)
- # bangalore-clj (3)
- # beginners (21)
- # boot (32)
- # cider (14)
- # clara (2)
- # cljs-dev (19)
- # cljsjs (8)
- # cljsrn (1)
- # clojars (1)
- # clojure (147)
- # clojure-australia (6)
- # clojure-brasil (8)
- # clojure-canada (2)
- # clojure-gamedev (3)
- # clojure-greece (2)
- # clojure-hk (5)
- # clojure-italy (10)
- # clojure-japan (8)
- # clojure-korea (4)
- # clojure-russia (25)
- # clojure-sg (2)
- # clojure-spec (36)
- # clojure-uk (34)
- # clojurescript (88)
- # cursive (157)
- # datomic (6)
- # devcards (1)
- # dirac (1)
- # editors-rus (3)
- # events (2)
- # funcool (1)
- # hoplon (57)
- # jobs (9)
- # lein-figwheel (2)
- # luminus (1)
- # om (156)
- # onyx (93)
- # perun (11)
- # rdf (65)
- # re-frame (36)
- # reagent (17)
- # ring-swagger (3)
- # specter (19)
- # untangled (33)
i just want to say: i’ve been writing javascript with flowtype for the past ~2 weeks. It’s a very nice type system and it’s very well implemented…. and I absolutely hate it. I miss clojure 😞
@bbloom No, no, you must be mistaken. Type systems are awesome 🙂
I’m finding new things to use clojure.spec
for almost every day, I have to say…
i think i’ve hit more false positives about NPEs from flowtype in two weeks than i’ve had ACTUAL NPEs in a year of Go
So it’s telling you "This will likely NPE" but the code wouldn’t?
basically it says something like “potentially null or undefined” b/c it’s doing a map lookup or something, but i know with 100% confidence by construction that value is in the map
and 2) using invariant(whatever, ‘whatever may not be null’) which basically is just a glorified manual throw npe
Must admit, when we were using core.typed at work, that was one of the problems we had: nil was contagious and then we kept getting complaints about code not accepting nil (when we knew nil wouldn't flow to that point),
@seancorfield: Have you run into anything like that with spec yet?
@shaun-mahood no, but that’s because spec isn’t "contagious" in the same way that type systems tend to be: spec’ing one piece of code doesn’t ripple out into other pieces of code.
@seancorfield: That's awesome - I ran into similar issues with schema in a very limited manner and it really bothered me. I know you'll put spec through a lot more than I ever will so I've been using your notes and comments about as sort of my real-world expectations.
I'm surprised you hit that with Schema since it's really just runtime assertions.
Well, it's more likely that I did something stupid or am remembering different problems then - I really didn't put a whole ton of effort into figuring out exactly what was going on and it was quite a while ago. I probably just didn't know what I was doing as well as I though I did :)
Is it a deliberate difference between Clojure and ClojureScript that ClojureScript's clojure.spec.test/check
only accepts a literal collection of syms instead of a code-generated value (e.g. (let [syms (filter in-my-namespaces? (st/checkable-syms))] (st/check syms))
will not work as it raises a Unable to resolve symbol: syms
error.
Question about multi-spec
, is it meant/possible to use with something else than a map? I cannot find examples and after a lot of trying it seems the multi-spec implementation doesn’t call the multi-method like one would expect
ah ok, i had a clear moment. I was a victim of multimethod + multi-spec reloading. It is possible with the right dispatch function
retagging is discussed in the docstring - it’s for gen and can be a fn as well
@jannis prob a question @dnolen would have to answer re check
@alexmiller Ok, I'll check with him
is anyone using this: https://github.com/tonsky/clojure-future-spec ?
@tmtwd yep, we use it. Not in something we deployed in production (yet). But I have used it quite a lot now and it works well
Is anybody doing things with clojure.spec/unform
at the moment? I asked something on the mailinglist about using it for data migrations, but no answer yet
not many from my impression (given the number of bugs I am aware of but no one has mentioned yet :)
data migration is one interesting use case for it though
thanks, for confirming the use case 🙂 I’ll see if I can make it work
Hello. With multi-spec, is there a way to generate values conforming to only a specific dispatch-value? For example, in the :event/event example in http://clojure.org/guides/spec, the generator generates all events. What is the best way to generate events of only a certain type?
@dmarjenburgh you can get the spec (and hence the generator) for a specific dispatch value by just invoking the multi-method, (event-type {:event/type :event/search})
Ah, ofcourse. Thanks! 🙂