kkinnear/zprint

Aliasing a function to another in :fn-map does not work on namespaced function calls

miridius opened this issue · 3 comments

I think this is best explained with an example:

zprint options:

{:fn-map {"dog" "cat"}}

Input:

(cat x y z)
(my/cat x y z)
(dog x y z)
(my/dog x y z)

Output:

(cat x
     y
     z)
(my/cat x
        y
        z)
(dog x
     y
     z)
(my/dog x y z)

As you can see, my/dog does not get formatted the same way as cat, even though it should according to the options.

Note: changing the options to {:fn-map {"dog" "cat" "my/dog" "cat"}} solves this (as a workaround)

Yes, I can reproduce this. Thanks for the succinct example. I have found and fixed this problem -- some missing code when I added the aliasing capability. It will be fixed in 1.2.4. Thanks for creating your own workaround! I appreciate the issue, and it is interesting to see that someone actually is interested in using the aliasing capability too. Thanks again!

zprint.core=> (zprint-file-str i276 "x" {:fn-map {"dog" "cat"}})
"(cat x\n     y\n     z)\n(my/cat x\n        y\n        z)\n(dog x\n     y\n     z)\n(my/dog x\n        y\n        z)\n"
zprint.core=> (print *1)
(cat x
     y
     z)
(my/cat x
        y
        z)
(dog x
     y
     z)
(my/dog x
        y
        z)

This was fixed in 1.2.4.