This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-24
Channels
- # architecture (4)
- # aws (1)
- # beginners (76)
- # boot (172)
- # cider (17)
- # cljs-dev (10)
- # cljs-experience (24)
- # cljsrn (45)
- # clojure (129)
- # clojure-berlin (1)
- # clojure-finland (1)
- # clojure-italy (8)
- # clojure-seattle-old (1)
- # clojure-sg (1)
- # clojure-spec (31)
- # clojure-uk (28)
- # clojurescript (88)
- # cursive (11)
- # data-science (1)
- # datomic (44)
- # fulcro (48)
- # hoplon (5)
- # jobs (3)
- # jobs-discuss (1)
- # leiningen (6)
- # luminus (42)
- # lumo (17)
- # off-topic (9)
- # om (29)
- # onyx (15)
- # pedestal (7)
- # protorepl (20)
- # re-frame (24)
- # reagent (46)
- # ring-swagger (2)
- # specter (2)
- # sql (3)
- # uncomplicate (58)
- # unrepl (29)
- # yada (5)
hi everybody, what's the way to spec something is a promise of some kind
not really any good way right now
I would focus on spec’ing the place where you deliver the value and receive the value
you could put the class of the promise elsewhere if you wanted to avoid creating a promise each time you ran the predicate
I’m not sure there’s much value in checking just that something is a promise. I presume what is of interest is that it’s a promise that returns something that matches a spec
however, checking for that would require you to block waiting for the promise to be delivered
so I think you instead want to validate the spec at the point where you are already retrieving the value
or where you are delivering the value
yeah I'm trying to spec a function return that returns a promise with an int?
since it's a :ret I'm not worried about instrument blocking on deref
I'm more interested in the doc aspect
Several times I've wanted to be able to spec "this should be an atom containing an X" so I feel the lack @jpmonettas -- but as @alexmiller says, a lot of the times where you would want this, spec would need to deref the container to check the value inside and that's not the correct semantics (it would block).
No, that's different. Atom deref is not blocking
We might add atom-of eventually
I meant more in the general "derefable" situation -- but you're right that each type of derefable is different.
All of the Clojure reference types do nonblocking read
Good point. Future/Promise are the outliers.
and delay
none of Future/Promise/delay are reference types
that is, by “reference type” I mean, IRef (not IDeref)
It would make me want to have the function return int, and instead call it in a future (which has the advantage that the caller controls both the wrapping and the dereference).
(since you don't mind the checker blocking on a deref to check the value anyway)
Golang is interesting for chan args, you can say "this arg is a chan of int that can only be take!en in that scope" etc
As do core.async chans via the port protocols