Tag gensym sourced symbols with metadata

Description

For static analysis tools derived from TANAL it is frequently useful to determine whether a symbol is user defined or the result of code generation. As tools analyzer depends on the Clojure core for evaluation and symbol generation a user wishing to annotate generated symbols must currently provide a binding replacing clojure.core/gensym with a snippet equivalent to the following patch. Such overloading is not appropriate for TANAL, TE* or user code as it is a redefinition of clojure.core behavior which should be standard rather than subjected to users with crowbars.

Environment

None

Activity

Show:
Andy Fingerhut
July 2, 2014, 12:41 AM

From the comments above it appears that this is not planned to be a final version of this patch, but FYI some automated scripts I have found that patch 0001-Annotate-generated-symbols-with-metadata.patch dated Jun 9 2014 applies cleanly to the latest Clojure master as of Jul 1 2014, but Clojure fails to build.

Reid D McKenzie
July 2, 2014, 7:37 AM

Thanks Andy, I'll rework and test it in the morning

Reid D McKenzie
July 7, 2014, 3:49 PM

Because of the work that clojure.lang.Symbol/intern does, exposing and using the metadata constructor directly makes no sense. The updated patch directly invokes clojure.lang.Symbol/withMeta rather than indirecting through clojure.core/with-meta and taking the performance hit of calling through a Var. Builds cleanly on my system.

Andy Fingerhut
August 2, 2014, 2:49 AM

Reid, although JIRA can handle multiple attachments with the same name, it can be a bit confusing for people, and for some scripts I have for determining which patches apply and test cleanly. Would you mind renaming one of your patches?

Reid D McKenzie
August 2, 2014, 4:55 AM

3rd and final cut at this patch.

Assignee

Unassigned

Reporter

Reid D McKenzie

Labels

None

Approval

None

Patch

Code

Priority

Trivial