rewrite-clj

https://github.com/clj-commons/rewrite-clj
2019-06-09T05:04:25.114500Z

@lee i noticed that in custom-zipper.core (at least in the cljc-spike-2 branch), position can throw but position-span does not. should they both behave similarly respect to throwing?

lread 2019-06-09T10:37:42.117500Z

thanks @sogaiu, I’ll have a look!

lread 2019-06-09T18:24:53.122200Z

Hi @sogaiu I had a look. Because position-span always calls position, position-span will benefit from the check (and throw) in position. That said, I think that the error message on the throw was slightly too specific and have adjusted. Thanks!

2019-06-09T23:59:11.132Z

@lee ah, it's true that position-span currently calls position and that does currently throw when calling with a non-custom-zipper, missed that 🙂 do you think it's unlikely that there is any danger in remembering to ensure there is some checking for a custom-zipper if the implementation of position-span changes in certain ways in the future? in this file, the vanilla defns stick out a lot to me because of the existence of defn-switchable (and its prevalence) -- it effectively creates new functions to use the clojure zipper implementation if the zipper is not custom, right? one of the underlying concerns appears to be whether a function is meant to be used with both types of zippers. when i see an ordinary defn in this file, i think, why is that not a defn-switchable? there is at least one case, edit, that is ok to call with either type of zipper, iiuc, and that sticks out -- was thinking to track this down and suggest whether there might be a note in the code regarding the reason. anyway, just trying to make sense of the code 🙂