Last active
February 22, 2017 20:47
-
-
Save levand/b7e25eae14da8f36a9a3688fd95606d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Currently, Arachne follows a particular idiom for creating named entities: | |
;; Every DSL form that creates an entity takes an optional first argument, which is its Arachne ID, | |
;; and also returns an entity ID | |
;; This permits two forms of defining and using components | |
;; Method A | |
(a/component :my.app/a 'whatever) | |
(a/component :my.app/b 'whatever {:a :my.app/a}) | |
;; and also | |
;; Method B | |
(def a (a/component 'whatever)) | |
(def b (a/component 'whatever {:a a})) | |
;; These are equivalent from a configuration point of view, but Method A | |
;; has the advantage of creating named components so they can be looked up by name elsewhere. | |
;; Now, having every component take an optional Arachne ID is kind of gross, | |
;; and having two ways to do it is one too many. | |
;; So what if you did this instead: | |
;; Method C | |
(a/def :my.app/a (a/component 'whatever)) | |
(a/def :my.app/b (a/component 'whatever {:a :my.app/a})) | |
;; This has the advantage of decomposing the creation of a component and naming it with an Arachne ID. | |
;; It also reads a bit more evidently (I think). | |
;; The downside is, it's a breaking change. | |
;; However, it's easy enough to fix and better now than later. |
My two cents, a/def
is ok. Reminds me of s/def
with spec.
i like a/def
but if most of the times we are going to be creating component maybe it could be worthy to create a simplified version:
something like:
(a/defc :my.app/a 'whatever)
(a/defc :my.app/b 'whatever {:a :my.app/a})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like it, but
a/def
is weird to me. What abouta/defcomp
ora/defc
which can be refered asdefc
allowingRefering
a/def
is also possible build I'm hesitating to shadow core'sdef
.