-
Notifications
You must be signed in to change notification settings - Fork 49
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
Ability to alias a function/macro as another one #234
Comments
I tried: :fn-map {"defn-xxxx" (-> zprint.config/default-zprint-options
:style-map
:rod
:fn-map
(get "defn"))} So far it's not working, although it might be for unrelated reasons |
Interesting problem, thanks for bringing it up. Before we get into the longer term solutions, I'm not sure why what you show, above, didn't work for you. Both of these work for me. The first one uses the current options map, and the second one (which is close to what you tried), uses a building block of the original configuration.
That is certainly one approach, and not a bad one. But your original issue was to support something where if people changed the which styles were used (which might well change what is configured in the So, yes, something like what you proposed in the first post would be a better answer. And I agree, we do need an answer for this particular use-case. My first thought was identical to yours, actually. Keying off of the type of the value in the So, yes, I want to think on it a bit more, but I'll do something that will solve this problem, and probably just what you have proposed. I'm also thinking of making a That sort of addition doesn't negate the need for the aliasing within the |
Probably it was something with my setup which is somewhat contrived, will give it another go later. I'd assume it works, particularly after your confirmation.
Happy about the hammocking!
Glad to hear! Thanks so much for your work. |
The alias support is now available in From You can now alias one funtion in the |
Thanks much! Awesome news. I'll be trying it out. I certainly owe you a big round of QAing/feedback - that is not forgotten :) |
Context
One may use a composition of styles:
Under such composition, the answer to the question "what is the style that will be applied to
defn
?" can easily be dynamic, and not even serializable:i.e., this value is not something users can immediately comprehend or copy/paste.
Use case
I have defn-like constructs, say
com.example/defun
ordefn-instrumented
.I'd want to be able to tell zprint "whenever you find these, please consider them equivalent to defn".
So, if hypothetically I changed my
:style [:community :justified :map-nl :pair-nl :binding-nl :rod :hiccup]
vector to something else, I would have not to update anything else -com.example/defun
anddefn-instrumented
would remain homogeneous, relative todefn
.Proposal
Assuming I'm requesting something new at all, the following might be an elegant API?
Or perhaps these could deserve instead a dedicated key, e.g.
:aliases
/:equivalent
.What do you think?
Thanks - V
The text was updated successfully, but these errors were encountered: