rewrite-clj

https://github.com/clj-commons/rewrite-clj
2019-06-05T00:37:24.071100Z

ah, thanks for mentioning that -- i think i see some here: https://github.com/borkdude/clj-kondo/blob/master/src/clj_kondo/impl/utils.clj

2019-06-05T10:24:16.003600Z

would things break if: 1) sexpr was removed from the Node protocol, 2) another protocol was created with just sexpr, 3) only those things that don't purely throw exceptions for sexpr implement sexpr (participate in the protocol for 2), 4) before using sexpr, one could use satistfies? to check whether it would be safe to call sexpr ?

borkdude 2019-06-05T11:19:12.004300Z

that would probably break the API yes. afaik the only things not seprs-able are comments and unevals? so it’s easy to write a predicate for that I guess

lread 2019-06-05T12:34:43.008Z

yeah, one of my goals is no breaking changes. I might almost achieve it - but have migrated cljs positional fns to clj positional support so there’s at least one!

lread 2019-06-05T12:38:56.011800Z

on that topic... do you guys know of any tools to test for breaking changes? I was thinking of comparing api fn signatures from current rewrite-cljs and rewrite-clj against my work.

borkdude 2019-06-05T13:15:32.012300Z

doesn’t rewrite-clj proper have a test suite you can run against your changes?

borkdude 2019-06-05T13:16:01.012800Z

clj-kondo has 70 tests and 500 assertions right now, you could maybe also try that

lread 2019-06-05T13:18:27.016Z

yeah it does have a good suite but rewrite-cljs suite was much smaller. just want to take what care I can to avoid unintentional breaking changes

borkdude 2019-06-05T13:18:52.016400Z

why not incorporate all of rewrite-clj’s existing tests?

lread 2019-06-05T13:29:20.016800Z

I have done that

lread 2019-06-05T13:30:53.017900Z

just trying to be extra careful

lread 2019-06-05T13:33:17.019900Z

do you think a tool that tests for api breakages between versions would be of general interest?

borkdude 2019-06-05T13:33:37.020200Z

I think a test suite already takes care of that?

lread 2019-06-05T13:35:17.021800Z

maybe it does if you you have complete coverage and haven’t made a human error

borkdude 2019-06-05T13:35:49.022100Z

so you tool would write tests for free? seems awesome 😉

lread 2019-06-05T13:36:33.023Z

ha! no

borkdude 2019-06-05T13:37:45.024900Z

(afk now)

lread 2019-06-05T13:38:14.025200Z

it would only compare api fn signatures between versions

lread 2019-06-05T13:38:52.026300Z

I’m getting the strong impression you would not value such a tool :simple_smile:

lread 2019-06-05T14:18:26.027100Z

martin klepsch goes over this type of idea in his recent talk: https://youtu.be/8klBWIwYfsY?t=1934

borkdude 2019-06-05T14:41:16.027800Z

I would value it, but I don’t see what it adds compared to a test suite. A good test suite tests all the arities of an API, that’s my assumption

borkdude 2019-06-05T14:42:41.028Z

I’ll watch the talk section

borkdude 2019-06-05T14:47:13.028400Z

I mean, as a library author, it should not come as a surprise that you’re breaking an API when you remove an arity 🙂

borkdude 2019-06-05T14:48:41.028700Z

as a library consumer that would be interesting I guess, since you’re not in control

borkdude 2019-06-05T14:49:35.029300Z

clj-kondo already saves the arities of functions in a cache, I guess diffing the cache on a next run wouldn’t be too hard

borkdude 2019-06-05T14:50:41.029900Z

but maybe it makes more sense as a standalone tool, so please go ahead @lee

borkdude 2019-06-05T14:51:12.030600Z

as part of cljdoc it would be useful for a wider audience I guess

2019-06-05T21:17:44.031500Z

ah sorry, i see that the link had a time in it. thanks!

lread 2019-06-05T21:38:19.035200Z

yeah for this hypothetical api comparison tool, I’m thinking of cases where either you’ve maybe come in as a maintainer of an existing lib (my case) and when there are many contributors - I expect newbies would like to know if they’ve accidentally broken the api

2019-06-05T21:38:53.035500Z

i expect some non-newbies would like to know too 🙂

lread 2019-06-05T21:39:29.036200Z

:simple_smile: I’ll ping martin to learn if he’s found any existing work.

lread 2019-06-05T21:43:26.037700Z

@sogaiu I think Arne Brasseur is doing something interesting that might be related. I think he’s generating docs for kaocha from tests. Here’s a random example: https://cljdoc.org/d/lambdaisland/kaocha/0.0-418/doc/cli-print-the-kaocha-configuration

lread 2019-06-05T21:45:07.038400Z

your comment block idea is interesting too. Personally, after experimenting, I convert to unit tests and delete my comment blocks.

lread 2019-06-05T21:45:40.039Z

but your comment blocks can become unit tests… interesting.

lread 2019-06-05T21:46:42.039700Z

I take it back, the kaocha example is not really related to what you are doing. But it is kind of cool, right? :simple_smile:

2019-06-05T21:48:44.042100Z

@lee it is interesting for sure. i've been thinking to record execution of code and generate / analyze results -- generating draft docs is one thing that could be done with this sort of thing.

borkdude 2019-06-05T21:48:56.042300Z

comment blocks that become tests, that sounds also like https://github.com/cognitect-labs/transcriptor

2019-06-05T21:49:12.042900Z

@borkdude indeed, that's one of the inspirations

2019-06-05T21:49:32.043400Z

there were some problems w/ transcriptor, and this is an experiment to work around some of them

lread 2019-06-05T21:55:09.044700Z

@borkdude, I manually tried your problem file in my cljs playground a while ago and forgot to tell you. I parsed it in and spit it out successfully.

borkdude 2019-06-05T21:55:52.045200Z

with tools.reader 1.3.2?

borkdude 2019-06-05T22:02:32.045400Z

confirmed, I tested it now too

borkdude 2019-06-05T22:02:56.045700Z

was there anything in particular you changed to make it work, or it just worked?

lread 2019-06-05T22:12:16.045900Z

just worked

lread 2019-06-05T22:13:25.046400Z

yes I am using tools.reader 1.3.2

borkdude 2019-06-05T22:18:44.047Z

the bug I’m getting with the original is that it tries to check if an empty string is a string consisting of linebreaks

lread 2019-06-05T22:21:11.048600Z

hmmm… I started this so long ago I don’t recall changes I made. But something must be different!

lread 2019-06-05T22:26:33.049500Z

I’m going to try to focus on finishing up my cljs ticket for now. If this is blocking you, let me know and I’ll take some time to dig in.

borkdude 2019-06-05T22:31:19.050400Z

Not really blocking, I’ll figure something out

borkdude 2019-06-05T22:31:25.050700Z

Thanks