rewrite-clj

https://github.com/clj-commons/rewrite-clj
2019-04-18T07:09:26.026300Z

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?

2019-04-18T08:08:23.027600Z

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.

lread 2019-04-18T10:26:46.028500Z

hey @sogaui, you are a help not a bother! 🙂

lread 2019-04-18T10:33:09.032900Z

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?

lread 2019-04-18T10:38:20.036800Z

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.

lread 2019-04-18T10:42:17.039500Z

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.

2019-04-18T12:14:17.045100Z

@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!

borkdude 2019-04-18T12:15:00.045500Z

leaving in a java.lang thing in cljc without a reader conditional is bad/confusing imo

lread 2019-04-18T12:18:33.047200Z

thanks @borkdude, it makes sense to me now that you guys say it

borkdude 2019-04-18T12:19:12.047600Z

note that there might be other platforms that will also be reading the code in the future, like CLR? 🙂

lread 2019-04-18T12:19:59.048400Z

ya being explicit is the way to go I think

lread 2019-04-18T12:23:41.052600Z

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.

borkdude 2019-04-18T12:24:10.052800Z

do you have a link to an example?

borkdude 2019-04-18T12:25:03.053400Z

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?

lread 2019-04-18T12:26:26.053600Z

Ya

lread 2019-04-18T12:26:38.054Z

Here’s a place where I added reader conditionals, but I think there are other places, I did not.

lread 2019-04-18T12:29:56.055700Z

I think it is clearer if I add reader conditionals everywhere there is doubt. Less mystery is better.

borkdude 2019-04-18T12:30:14.056100Z

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

borkdude 2019-04-18T12:32:13.057500Z

this is what I did here: https://github.com/borkdude/finitize/blob/master/src/finitize/core.cljc#L19

lread 2019-04-18T12:32:16.057700Z

Hmm… what was I thinking of then? Gotta run now, will try to have look-see later.

lread 2019-04-18T12:36:40.059100Z

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.

borkdude 2019-04-18T12:39:43.059400Z

type-sym can also be specified as default in order to provide default implementations for protocols.

borkdude 2019-04-18T12:42:12.059600Z

fwiw