-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Infer var metadata for 'proxy' vars #171
Conversation
@@ -41,7 +42,7 @@ | |||
(defn- maybe-add-spec | |||
"If the var `v` has a spec has associated with it, assoc that into meta-map. | |||
The spec is formatted to avoid processing in the client (e.g. CIDER)." | |||
[v meta-map] |
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.
Simplifies a -> chain below
Is |
I can see how 'proxy' is an overloaded term, but 'aliased' immediately brings to mind namespace aliases, which would seem greatly confusing to me (particularly in a project that already deals with aliases).
|
When I hear of Clojure and proxy I immediately think of https://clojuredocs.org/clojure.core/proxy That's why I don't like this. And your examples in the tests are really aliases, after all this terminology extends to more than namespaces. I'm open to other suggestions, even if I can't offer anything better than |
Btw, I don't want us to spend too much time on this - the implementation seems good and solves a real problem. If we don't come up with a better name relatively quickly (a day or so), I'm fine to stick with the current terminology. |
(:require | ||
[orchard.misc :as misc]) | ||
(:refer-clojure :exclude [find-ns find-var all-ns ns-aliases])) | ||
[clojure.string :as string] |
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.
It seems that str
is the preferred alias across the project, any reason to have it different here?
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.
Agreed - it's best to be consistent about this.
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.
If you don't mind I'd like to settle onstring
then, project-wide. We can add a kondo rule for avoiding further churn.
My point of view as someone who tends to maintain other people's code a lot, is that Sierra-style aliases only make our lives easier.
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.
It's not a big deal for me, but such changes should be discussed outside the scope of this PR.
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.
I see str
much more often than string
(almost never the latter, actually). I don't know about feverishly enforcing some arbitrary rule one person established. Besides, he mentions exceptions in his blog post too.
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.
For me, most of all it's about not memorizing arbitrary abbreviations someone wrote years ago e.g. cljs.analyzer.api :as ana
- those represent unnecessary cognitive load to me.
I agree that str
is very well-known, but when one uses a convention 99.9% of the time, having an exception to break the rule isn't exactly convenient.
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.
So then everyone will have to memorize whether this is a project that chose string
because of a convention or, you know, the rest 99.9% of the projects 😄.
Having said that, I claim no say in this issue.
src/orchard/info.clj
Outdated
@@ -98,37 +98,47 @@ | |||
;; a special symbol - always use :unqualified-sym | |||
(some-> (cljs-ana/special-meta env unqualified-sym) | |||
(cljs-meta/normalize-var-meta)) | |||
;; an NS | |||
|
|||
;; a NS |
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.
Well ackshually, an NS
is correct.
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.
Indeed, it's pronounced as en es
, so the normal rules about consonants don't apply here.
I absolutely agree; I was reading through the code waiting and waiting where a I think it's worth picking up a better term. |
Thanks for the input! I'll consider those. How about "delegate vars"? |
I think I like the most |
Same, I think of delegates in C++/C# (i.e., function pointers). |
Merging. btw, I tested out this with Compliment and it works there too 🍻 |
Part of clojure-emacs/cider-nrepl#788
Use case explained over there.
...I had attempted this before: clojure-emacs/cider-nrepl#790 but it was targeting the wrong middleware. This impl is simpler / more predictable, needing no
pmap
-like parallelism.I've tried this one locally, and it works as intended.
Works on CLJ and CLJS, tests added for both.
Cheers - V