rewrite-clj

https://github.com/clj-commons/rewrite-clj
2019-05-16T00:00:10.084700Z

he he -- yes, for the moment, though i think it would be nice for the eventual merger too 🙂

lread 2019-05-16T00:01:04.085500Z

I have written an email to the author or rewrite-clj, but no response yet.

2019-05-16T00:01:40.086200Z

yes, it seems difficult to reach him...may be we can find someone who can find him in person 🙂

lread 2019-05-16T00:02:05.086700Z

hope he’s ok. life happens sometimes.

lread 2019-05-16T00:02:24.087400Z

for deps.edn, I could ease into it with https://github.com/RickMoynihan/lein-tools-deps I suppose

2019-05-16T00:02:31.087700Z

indeed!

2019-05-16T00:02:37.087900Z

hadn't seen that -- will take a look

2019-05-16T00:02:47.088200Z

rewrite-clj's project.clj seems pretty straightforward

2019-05-16T00:03:08.088700Z

need to check rewrite-cljs' though

lread 2019-05-16T00:03:11.088900Z

yep

lread 2019-05-16T00:03:26.089300Z

I think deps are pretty straightforward…

lread 2019-05-16T00:03:33.089600Z

let me put this on my todo list

lread 2019-05-16T00:04:16.090200Z

I miss my old rewrite-cljs playground squirrel.

lread 2019-05-16T00:08:48.090600Z

:squirrel:

2019-05-16T00:28:32.091500Z

lol -- it's been playing around over here, hoping to end up in a native-image project 🙂

borkdude 2019-05-16T07:30:28.091700Z

native image for what?

borkdude 2019-05-16T09:14:41.092100Z

I’m slightly worried about the unreachability of the rewrite-clj author. I hope he’s doing OK.

borkdude 2019-05-16T11:59:33.092500Z

ok, phew, his account is showing activity: https://github.com/futurice/entranceFE/pull/16 so I guess he’s fine 😉

2019-05-16T13:53:38.092800Z

good to hear xsc seems to be ok 🙂

2019-05-16T13:55:45.095600Z

@borkdude i'm working on a proof-of-concept editor extension to perform the inline-def transformation you blogged about. so iiuc, it's kind of the opposite of one of the things your clj-kondo does (clj-kondo detects and can remove(?) inline-defs).

borkdude 2019-05-16T13:56:19.096400Z

clj-kondo only detects, it does no transformations

lread 2019-05-16T13:57:25.097600Z

Good to see xsc is active. I wonder if there is a way we can get his attention.

borkdude 2019-05-16T13:58:40.098100Z

@sogaiu what would your editor extension do? is there any ticket with a longer description?

2019-05-16T14:06:42.101500Z

@borkdude thanks for the clarfification on what clj-kondo does. i'm still finishing up an initial implementation so no description yet, but the idea is to be able to have your pointer / cursor somewhere in a defn, you invoke a command, and the result is that the defn surrounding the cursor is auto-detected and then the inline-def transformation is applied to it. does that make sense?

borkdude 2019-05-16T14:07:31.101900Z

I’m not sure why an editor would have to do that for me? it’s usually only a temporary debugging thing for me

2019-05-16T14:13:41.107300Z

it's a proof of concept for making stand alone extensions that don't bloat other extensions. the design uses native image so that different editors can use the same native image piece.

borkdude 2019-05-16T14:27:07.107500Z

@sogaiu that’s a cool idea 🙂 makes a lot of sense actually

borkdude 2019-05-16T14:28:56.108700Z

but for inline def, I usually only want to define something little, not have the editor insert a lot of them for me automatically. but there are several other things that could be done

borkdude 2019-05-16T14:30:09.108900Z

like removing them 😉

2019-05-16T16:12:07.121100Z

@borkdude just to clarify, the current code is meant to transforms one defn (the one that's automatically detected based on the cursor). on a side note, it also handles destructuring types of situations for the arguments of the function, so one ends up with a (do (def a a) (def b b) ...) inside the result if one started w/ something like (defn my-fn [{:keys [a b]}] (+ a b)). i think one minor benefit of programmatic inline defs is it's potentially less error-prone, but now that you mention removal, it seems that the programmatic process could be inserting information (e.g. metadata or special comments) that would make detection for the removal process easier. at any rate, i'm hoping to publish a sample before too long so folks can experiment with making things for emacs, atom, vscode, etc. that can work without interfering with existing clojure-related things like cider, chlorine, and calva (so they can all focus on their core features, possibly spinning stuff out to make them leaner and easier to maintain). (my original intent was to provide a command that would instrument functions with tap / trace expressions so i could quickly get code that would record execution information for diagnostic / debugging purposes, but i haven't worked out the piece for recording such information yet, so when i noticed your inline def blog post, i thought it might be a candidate for use in a proof-of-concept.) your work on clj-kondo, particularly the native-image portions has been great to reference, thanks for sharing your findings 🙂

borkdude 2019-05-16T16:12:58.121400Z

cool idea, looking forward to it

lread 2019-05-16T16:58:53.122100Z

@sogaiu I have updated my rewrtite-cljs playground with deps.edn https://github.com/lread/rewrite-cljs-playground/blob/cljc-spike-2/deps.edn

2019-05-16T17:00:27.123Z

thanks! i appreciate it :)

lread 2019-05-16T17:00:59.123600Z

It was even easier than I expected. Which I find myself often saying when working with clojure!

lread 2019-05-16T17:01:32.124100Z

As usual am happy to hear about any issues you encounter.

2019-05-16T17:07:00.128900Z

he he -- just pulled the change, and performed the first test. working ok so far, now on to the second test (native-image building).

lread 2019-05-16T17:07:13.129100Z

coolio!

2019-05-16T17:09:15.130400Z

looks good on the native-image building side, thanks!

lread 2019-05-16T17:09:54.131Z

@borkdude, I am wondering about open source etiquette and rewrite-clj author not responding. I think as I get closer to an alpha-ready release of my cljc version, if he hasn’t responded, I’ll raise a git issue over at rewrite-clj as maybe another way of getting his attention. I don’t want to be a pest, but I also would love to get a response.

lread 2019-05-16T17:10:27.131400Z

that’s great @sogaiu!

borkdude 2019-05-16T17:39:33.132100Z

@lee I think in case of non-responding authors, all we have is fallback on the open source license, which is MIT for rewrite-clj

borkdude 2019-05-16T17:39:48.132400Z

but creating an issue might work.

lread 2019-05-16T18:37:19.133Z

right, good point, thanks