-
Notifications
You must be signed in to change notification settings - Fork 38
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
"Unmunge" deftype field names #33
Labels
Comments
So everything that comes from |
Yes, we may assume that. |
Yeah, that'd be nice. |
Didn't even take 8 years 🎉 |
Nice! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you have a Clojure type like
then
(.x
completes to(.x_y
instead of(.x-y
. That's because for a deftype a class is generated, and the field names of the class are the "munged" names of the deftype's fields, i.e., hypens are replaced with underscores.In Clojure on the JVM,
(.x_y foo)
actually works but it relies on this very implementation detail and is not portable to the CLR or ClojureScript. Thus, it's better to use(.x-y foo)
as this is the documented way to access fields of a deftype.So it would be nice if CIDER could directly suggest the correct version when completing. The fact that can be exploited is that all classes (and only those) generated for a deftype implement
clojure.lang.IType
(see https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L396). Therefore, I suggest to "unmunge" field names of classes implementingIType
.The text was updated successfully, but these errors were encountered: