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
RefMap or resolve as protocol method #63
Comments
I just noticed the |
The refmap construct is similar to refset, but returns a map from keys to resolved refs.
PR #64 |
Can you explain your use-case further? |
In the config map I want to have:
Outcome in the system map:
Something along these lines: ;; ns registry
(derive ::handler :module/const)
(defn register [[k v]]
#_(... register v to handle events named k))
(defmethod ig/init-key ::handlers [_ handlers]
(run! register handlers)
handlers)
;; ns my.handlers
(defn foo ...)
(defn bar ...)
(derive ::foo ::registry/handler)
(derive ::bar ::registry/handler)
(def config {::foo foo
::bar bar
::registry/handlers (ig/refmap ::registry/handler)}) |
The refmap construct is similar to refset, but resolves to a map from keys to resolved refs, rather than a set of refs; it is useful when the keys are meaningful to the logic beyond just being a slot in the config map, and are required in further logic. Resolves weavejester#63
This allows implementing "RefThing"s beyond just Ref & RefSet that resolve in a custom way. For example a RefMap would be like RefSet but would resolve to a map `{k -> ref}` instead a refs set. Related to weavejester#63
The refmap construct is similar to refset, but resolves to a map from keys to resolved refs, rather than a set of refs; it is useful when the keys are meaningful to the logic beyond just being a slot in the config map, and are required in further logic. Resolves weavejester#63
This allows implementing "RefThing"s beyond just Ref & RefSet that resolve in a custom way. For example a RefMap would be like RefSet but would resolve to a map `{k -> ref}` instead a refs set. Related to weavejester#63
This allows implementing "RefThing"s beyond just Ref & RefSet that resolve in a custom way. For example a RefMap would be like RefSet but would resolve to a map `{k -> ref}` instead a refs set. Related to weavejester#63
This allows custom references to be added that resolve in different ways. For example, a RefMap type might act the same as a RefSet, but include the keys for each referenced value. See issue weavejester#63.
The refmap construct is similar to refset, but resolves to a map from keys to resolved refs, rather than a set of refs; it is useful when the keys are meaningful to the logic beyond just being a slot in the config map, and are required in further logic. Resolves weavejester#63
RefLike protocol was extended. RefMap construct was not accepted into the core. |
These methods allow a RefLike implementation to determine which dependencies are optional for a reflike, and which dependencies are mandatory. Also renames `include-refsets?` to `optional-deps?`. Resolves: weavejester#77 See also: weavejester#63, weavejester#68
These methods allow a RefLike implementation to determine which dependencies are optional for a reflike, and which dependencies are mandatory. Also renames `include-refsets?` to `optional-deps?`. Resolves: weavejester#77 See also: weavejester#63, weavejester#68
These methods allow a RefLike implementation to determine which dependencies are optional for a reflike, and which dependencies are mandatory. Resolves: weavejester#77 See also: weavejester#63, weavejester#68
RefMap
would be likeRefSet
but would resolve to a map{k -> ref}
instead a refs set. Knowing the key can be useful (think handler registration).Alternatively, extend the
RefLike
protocol with aresolve
method and inexpand-key
postwalk the config via it, this would allow customRefThing
s. Sample:The text was updated successfully, but these errors were encountered: