Problem
Not convenient communicating to analysis
- Only specific reader metadata survives analysis
- Usually related to compilation or debugging
- :tag, :line, :static
- Can only attach in specific contexts
- parameters
- local bindings
- Makes it difficult communicating to tools that utilise the results of analysis
- Example: attaching metadata to function calls
- ^{:my-m 1} (float? 1)
- :my-m is irretrievable from analysis
- Problem: cannot expect to attach metadata to macro calls or inlining functions.
- Any other examples?
- Use case: annotating polymorphic function calls with type arguments in Typed Clojure
- ^{:inst [Integer Integer]} (my-poly arg1 arg2)
Labels:
1 Comment
Hide/Show CommentsMay 07, 2012
Alan Malloy
Regarding the macro/inline problem, you might be interested in http://dev.clojure.org/jira/browse/CLJ-865. I have a patch which, if applied, would make it possible to attach this metadata to macros and (I think) inlined functions without issue.