Functions with non-qualified return type hints force import of hinted classes when called from other namespace
Description
Environment
Attachments
Activity
Alex Miller August 18, 2015 at 11:03 PM
Moving back to screened as fogus screened the preferred (by Rich) version.
Fogus August 14, 2015 at 3:18 PM
It would be better if the description said the word "preferred," but based on my reading resolving the tags in defn is the winner (0001-CLJ-1232-auto-qualify-arglists-class-names.patch). Thankfully that's the one that I screened as I agree that non-trivial changes to the compiler are to be avoided. That said, of course that patch does modify the compiler but since it's a change that pulls out some code into a useful method I let it through. To my mind that was a trivial (and justifiable change). Of course, if we want to avoid any compiler changes then this patch would have to be reworked.
Nicola Mometto August 12, 2015 at 12:17 PM
Reading Fogus' last comment, it seems to me that he actually screened the current patch (the one who resolves tags in defn rather than in the compiler) "Applied the 0001-CLJ-1232-auto-qualify-arglists-class-names.patch to master [..]"
Alex Miller August 11, 2015 at 11:08 PM
Nicola and Fogus, would appreciate an eye as to whether I just made the proper alterations in the description.
Alex Miller August 11, 2015 at 11:01 PM
Made preferred approach clear in the description and moved back to vetted. I believe the other ticket was screened by Fogus so this needs to be re-screened with the preferred approach ticket.
Details
Assignee
UnassignedUnassignedReporter
Tassilo HornTassilo HornApproval
OkPatch
Code and TestPriority
MajorAffects versions
Fix versions
Details
Details
Assignee
Reporter
Approval
Patch
Priority

You can add a type hint to function arglists to indicate the return type of a function like so.
The problem is that now when I call `linkedlist` exactly as above from another namespace, I'll get an exception because java.util.List is not imported in there.
There are two workarounds: You can import the hinted type also in the calling namespace, or you always use fully qualified class names for return type hints. Clearly, the latter is preferable.
Approach: Resolve the tags in the defn macro.
Patch: 0001-CLJ-1232-auto-qualify-arglists-class-names.patch
Screened by: Fogus
Alternate approach: Make the compiler resolve the return tags when necessary (tag is not a string, primitive tag (^long) or array tag (^longs)) and update the Var's :arglist appropriately. Patch: 0001-auto-qualify-arglists-class-names-v4.patch. Note that this patch had problems with Hystrix, which was using non-conformant arglists - Hystrix has since been patched.