[CLJ-918] Vars with {:macro true} meta data do not work when loaded from AOT compiled file Created: 23/Jan/12 Updated: 13/Sep/12 Resolved: 13/Sep/12 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Jannik Schorg | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | Compiler, enhancement, metadata | ||
| Environment: |
Tested with 1.3.0 and 1.4.0 |
||
| Patch: | New |
| Description |
|
When defining a var with ^{:macro true} the call of the binded macro does emit a warning when the definition has been AOT compiled. See example outputs with demo code here: https://refheap.com/paste/389 Bronsa on #clojure created a patch: http://sprunge.us/bWcc |
| Comments |
| Comment by Andy Fingerhut [ 13/Sep/12 2:29 PM ] |
|
Duplicate of CLJ-1021. Later ticket kept in preference to this one, because it has a patch and this one does not. |
[CLJ-916] into loses metadata Created: 21/Jan/12 Updated: 18/Aug/12 Resolved: 18/Aug/12 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.5 |
| Type: | Defect | Priority: | Major |
| Reporter: | Mark Swanson | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 4 |
| Labels: | into, metadata, walk | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
The into fn loses metadata. I'm seeing some team members (myself included) rely on metadata. Metadata has been incredibly useful in some cases, however the silent destruction of metadata by core clojure fns (into, walk, etc) have been a source of increasing complexity and confusion. A team member could start relying on a 3rd party library that used 'into'. Actually, the into fn could essentially be added to the code base at any time in many ways. Wrt metadata the potential for incidental complexity increases exponentially as more developers and libraries enter the mix. One of the reasons Clojure has worked for us so well is because it has greatly reduced incidental complexity. |
| Comments |
| Comment by Andy Fingerhut [ 01/Mar/12 4:42 AM ] |
|
Someone please correct this if it is wrong, but it seems that into loses metadata because it is implemented using transients, and transients lose metadata. If true, then one way to fix this ticket is to implement metadata for transients. Are there any fundamental reasons why it would be difficult to add metadata to transients, as long as the metadata itself was immutable? |
| Comment by Andy Fingerhut [ 16/Mar/12 4:57 AM ] |
|
First rough cut of a patch that makes not only into, but also select-keys, clojure.set/project, and clojure.set/rename preserve metadata. Added tests for these and many other functions. Still some open questions about other functions not tested in comments. This patch does not attempt to make transients preserve metadata. |
| Comment by Andy Fingerhut [ 23/Mar/12 8:03 PM ] |
|
clj-916-make-into-and-others-preserve-metadata-patch2.txt is semantically same patch and comments as March 16, 2012. Merely touched up to apply cleanly to latest master as of Mar 23, 2012. |
| Comment by Aaron Brooks [ 26/May/12 10:58 PM ] |
|
I just ran into this issue myself. Is there anything that I could do to help get this fixed? Test writing? Patch checks? I'm happy to help in any way I can. |
| Comment by Andy Fingerhut [ 27/May/12 1:11 AM ] |
|
You could examine the existing patch, including its tests, and see if it would have done what you were hoping it would do. Add a comment here regarding whether the changes look good to you. The attached patch is already on my weekly list of prescreened patches, but it is only one among many. |
| Comment by Fogus [ 15/Aug/12 1:14 PM ] |
|
The code is clean and tests test what they should test. Regarding the questions in the test file:
One final point. I'd prefer that tickets be addressed in isolation and not contain extra fixes. This is a personal preference, but one that I'd like to take up on the clojure-dev list. |
| Comment by Andy Fingerhut [ 16/Aug/12 12:38 AM ] |
|
clj-916-make-into-preserve-metadata-patch1.txt dated Aug 15 2012 only changes the behavior of into so that it preserves metadata. One or more other tickets will be created for some other functions that currently do not preserve metadata, but perhaps should. |