i'm back to bother you again 🙂 i noticed in the recently updated cljc-spike-2 branch in some locations there is mention of java.lang.Character (e.g. in reader.cljc) but it isn't hidden behind a reader conditional. is that intentional?
in other news, it appears that changing the last line of position-in-range? to:
(if (= r end-row) (< c end-col) true))))
causes the previous examples for [2 4], [2 5] and [3 8] [3 9] to behave better. don't know if it has any undesirable effects.hey @sogaui, you are a help not a bother! 🙂
The java.lang.Character hint does not cause cljs to choke, so I left it in. I’ve tried to preserve the type hints original authors put in. If I can avoid the noise of reader conditionals, I have, but maybe this causes more confusion than not?
And thanks for looking deeper into the positional stuff. I also transcribed associated unit tests, Adding your scenarios will certainly help. I think the positional finds are used by paredit which came along with the cljs version.
I will be travelling through the weekend and into early next week, so I won’t likely be coding, but I will be checking slack.
@lee thanks for the responses re: java.lang.Character -- in the same file, there are some other functions that use reader conditionals for one of their arguments (reader), so it seemed odd. perhaps it doesn't really matter 🙂 re: position-in-range? -- the change i tried is just a guess based on working through some examples; i don't really understand the logic very well. in any event i hope there is some appropriate fix that can be found. safe travels!
leaving in a java.lang thing in cljc without a reader conditional is bad/confusing imo
thanks @borkdude, it makes sense to me now that you guys say it
note that there might be other platforms that will also be reading the code in the future, like CLR? 🙂
ya being explicit is the way to go I think
In the spirit of being explicit, I think maybe Object vs object and String vs string might be automatically handled between clj/cljs (?) but I should probably add in reader conditionals around those too.
do you have a link to an example?
do I understand correctly that rewrite-cljs will be a .cljc port of rewrite-clj so it can run on both the JVM and Node/browser?
Ya
Here’s a place where I added reader conditionals, but I think there are other places, I did not.
I think it is clearer if I add reader conditionals everywhere there is doubt. Less mystery is better.
I think it’s even needed, because when I type this into a REPL I get:
WARNING: Use of undeclared Var cljs.user/Object at line 1
this is what I did here: https://github.com/borkdude/finitize/blob/master/src/finitize/core.cljc#L19
Hmm… what was I thinking of then? Gotta run now, will try to have look-see later.
Here’s a place I used no reader conditional https://github.com/lread/rewrite-cljs-playground/blob/cljc-spike-2/src/rewrite_clj/node/seq.cljc#L34 … assumed it was ok because all unit tests passed but maybe not exercised. dunno, will take a look.
type-sym can also be specified as default in order to provide default implementations for protocols.
fwiw