-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add state-flow.api namespace #118
Conversation
ac3d4e0
to
966e6c5
Compare
Does it make sense to move this to state-flow.api now? That will probably save another deprecation. Still looks inconsistent to me, I would keep From the library development perspective it makes sense to keep state primitives in the state-flow.state namespace because they are the building blocks on top of which we build state-flow itself. There is a hierarchy of dependency. |
@sovelten We're definitely interested in all forms of possessing and consuming 🍰! There's a disconnect between your view of That's because flow/get ;; get what?
flow/modify ;; modify what?
flow/return
flow/invoke
api/get ;; get what?
api/modify ;; modify what?
api/return
api/invoke We think this organization is more intention revealing: state/get ;; oh! We're getting state!
state/modify ;; oh! We're getting state!
flow/return
flow/invoke Is that clear? |
That's quite clear, I'm just not sure I agree. (state/return v) -> (State. (fn [s] [v s])) Even though they don't change the state, they deal directly with the state transition machinery and data structure defined in the state ns, one we don't want to expose the rest of the library to. Let me say first of all that That's why I propose to keep (flow/invoke ...)
(flow/get-state ...) ; names may vary
(flow/swap-state ...)
(flow/return ...) I believe this is having the cake and eating it. |
That works for me, personally, but @philomates expressed a distaste for fns named |
I don't see this fully (though I'm trying). What is "state aware" about |
Yeah... I guess? 😅 Now, the blorb api just happens to also be useful for composing flows (because flows deep down are just fancy blorbs). So we can expose part or all of the blorb api to the user. Hope that all makes sense now. (after note: Some of the things we deal with are not even an api to blorb, they are an api to any wobble, which is a protocol that blorb implements. This is the case for fmap, sequence and possibly others. return is directly part of the implementation of the wobble protocol for blorb) |
Not a bit, but thanks for trying ;) |
800ac2b
to
2ab11f9
Compare
@sovelten as ordens! I think this is great now. Still need to update the README and walkthrough, but we're getting close. |
Also deprecate: state/return (replaced by core/return) state/wrap-fn (replaced by core/invoke)
47cade2
to
c9149e8
Compare
@@ -92,7 +100,7 @@ | |||
(m/return ret#)))) | |||
|
|||
(defmacro flow | |||
"Defines a flow" | |||
"Creates a flow which is a composite of flows." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯 Xzibit approves
This is take 2 of #117, which originally started as "let's add fmap somewhere"
state-flow.api
Introduce a new
state-flow.api
namespace which imports the following vars:Deprecates
Also
Rationale:
We wanted to add
fmap
and decided it made more sense incore
than instate
. While reviewing this, we realized thatstate/return
andstate/wrap-fn
have little to do with state, so they probably belonged incore
as well, and we found that the namewrap-fn
was confusing, henceinvoke
.The same conversation also revealed that there is some pain in having to require 4 namespaces in order to use state-flow in its most common use at Nubank: with clojure.test and matcher-combinators. That's what led us to the
api
namespace.TODO
[state-flow.api :as flow]
flow/invoke
andflow/return
in flows.