parinfer

chrisoakman 2017-10-16T01:24:01.000021Z

I heard lots of great feedback about Parinfer at the Conj this year. Mostly in hallway conversations.

chrisoakman 2017-10-16T01:25:51.000052Z

The most common "negative" thing I heard was that Cursive users do not think they are using Parinfer since it wasn't the same thing that Shaun demoed in Atom during his talk.

chrisoakman 2017-10-16T01:26:34.000034Z

I spoke with one woman who's story was really indicative of feedback I heard from other people. She was new to Clojure, primary from a Ruby background.

chrisoakman 2017-10-16T01:26:44.000113Z

Her company hired her for Ruby, then switcher her onto a Clojure project.

cfleming 2017-10-16T01:26:51.000083Z

@chrisoakman Right, I’m waiting on getting some bugs resolved before I push it out (v3 that is).

chrisoakman 2017-10-16T01:26:59.000115Z

me: "Do you use Cursive"? her: "No, I use IntelliJ."

chrisoakman 2017-10-16T01:27:13.000111Z

A couple questions later I learn that she is using Cursive, but is unaware of it.

cfleming 2017-10-16T01:27:16.000198Z

I tried to use it for a while, but it was pretty painful without it.

cfleming 2017-10-16T01:27:22.000038Z

Hehe, yeah, that happens.

chrisoakman 2017-10-16T01:27:32.000189Z

me: "Are you using Parinfer?" her: "No - I just use whatever Cursive does."

chrisoakman 2017-10-16T01:28:21.000011Z

I then told her that she was in fact using Parinfer. And she was very adamant that she was in fact not using Parinfer because it was not what she had seen during Shaun's demo.

chrisoakman 2017-10-16T01:28:40.000144Z

Then I explained that Cursive was on an older version, etc, etc.

chrisoakman 2017-10-16T01:28:56.000112Z

But - I thought her story was very indicative of what I heard from at least 6 different people at the Conj.

cfleming 2017-10-16T01:29:00.000088Z

Parinfer actually isn’t on by default in Cursive, so if she didn’t do anything she actually wouldn’t be using it.

chrisoakman 2017-10-16T01:29:16.000166Z

Maybe one of her co-workers turned it on by default for her.

cfleming 2017-10-16T01:29:22.000147Z

But yeah, I’m keen to get v3 out there.

chrisoakman 2017-10-16T01:29:24.000096Z

Anyway - this is what she told me.

cfleming 2017-10-16T01:29:38.000040Z

Thanks, that’s interesting - yeah, that’s likely.

chrisoakman 2017-10-16T01:30:35.000001Z

I don't think there's anything particularly wrong if people are unaware they are using Parinfer. In fact, that's arguably a design goal. "It just always works that way." is a great thing IMO

chrisoakman 2017-10-16T01:31:03.000096Z

@cfleming Are you blocked on parinfer-jvm being updated to the latest parinfer.js ?

chrisoakman 2017-10-16T01:31:51.000020Z

That is definitely something I want to help facilitate if necessary. Either updating it myself or convincing someone else to do it for us 😂

cfleming 2017-10-16T01:32:01.000144Z

@chrisoakman No, they’re actually parinfer v3 bugs: https://github.com/cursive-ide/cursive/issues/1303#issuecomment-336554960

cfleming 2017-10-16T01:32:46.000074Z

I assume they’re also present in Atom, but IntelliJ likes to reformat code a lot, which creates overlapping changes that v3 doesn’t handle well yet.

cfleming 2017-10-16T01:33:38.000054Z

I actually have v3 implemented in a branch, but in IntelliJ v3 is currently not very usable.

chrisoakman 2017-10-16T01:34:23.000043Z

When you say "v3" I assume this is what we currently call smartMode ?

cfleming 2017-10-16T01:34:27.000184Z

Right.

chrisoakman 2017-10-16T01:35:39.000011Z

Would it be helpful if parinfer-jvm were up-to-date with parinfer.js?

cfleming 2017-10-16T01:36:15.000164Z

No, I actually have those changes merged into my version, but my internal version has diverged somewhat from parinfer-jvm.

chrisoakman 2017-10-16T01:36:42.000120Z

FWIW there have been exactly zero issues opened against atom-parinfer since adding smartMode earlier this year

cfleming 2017-10-16T01:37:05.000168Z

I wanted to make the code as simple as possible to minimise porting bugs, so I removed any functionality I wasn’t actually using (i.e. had already been implemented in Cursive elsewhere, like tab stops)

chrisoakman 2017-10-16T01:37:37.000075Z

ok

chrisoakman 2017-10-16T01:38:00.000048Z

It would be nice if there were just one codebase for Parinfer on the JVM.

cfleming 2017-10-16T01:42:02.000133Z

Absolutely, mine is still based on parinfer-jvm and could be used as the basis for a port.

👍 1
cfleming 2017-10-16T01:43:28.000155Z

I think there are a couple of issues - as smart mode gets more complex, it needs a deeper integration into the editor.

cfleming 2017-10-16T01:43:45.000089Z

See https://github.com/shaunlebron/parinfer/pull/170 for an example.

cfleming 2017-10-16T01:44:06.000027Z

I wrote a wall of text about why this was required, but I can’t find it now, I thought it was in an issue.

cfleming 2017-10-16T01:45:29.000004Z

That one there is about why I can’t run paren mode before indent/smart mode. I have a good solution for this, which marks inconsistent indentation in the editor and lets the user fix it rather than trying to fix it automatically.

cfleming 2017-10-16T01:47:50.000085Z

See here for some screenshots: https://clojurians-log.clojureverse.org/parinfer/2017-08-18.html

chrisoakman 2017-10-16T01:50:50.000010Z

These are all great notes.

chrisoakman 2017-10-16T01:51:24.000082Z

I knew there had been some discussion about all this, but I wasn't really watching this channel during that time.

chrisoakman 2017-10-16T01:51:51.000038Z

smartMode proved to be trickier to implement in atom-parinfer than indent / paren mode before

chrisoakman 2017-10-16T01:52:14.000155Z

It seems to work fine, but I don't love the current implementation right now. I want to improve it.

chrisoakman 2017-10-16T01:52:45.000098Z

I spoke with Ryan a bit about this during the Conj.

cfleming 2017-10-16T01:53:02.000062Z

It’s a hard balance - as smart mode gets more complex, I think it will need more information from the editor to provide more context to the changes that the user has made.

chrisoakman 2017-10-16T01:53:20.000136Z

I'm sorry you have to deal with this. It sounds like an Object Oriented Mutable State nightmare.

cfleming 2017-10-16T01:53:47.000075Z

Well, not really - it’s actually just that IntelliJ is much more complicated than e.g. Atom.

chrisoakman 2017-10-16T01:53:47.000172Z

Or - at least caused by a bunch of stateful OO code.

cfleming 2017-10-16T01:54:17.000023Z

It’s very common in IntelliJ to perform actions (e.g. refactorings) which affect files without them ever being opened in an editor.

cfleming 2017-10-16T01:55:21.000079Z

And also actions which cause multiple edits in complicated patterns. I suspect that the Atom version would suffer the same bugs if users were using the paredit commands with parinfer, which I do.

cfleming 2017-10-16T01:56:32.000021Z

At least for some of those bugs. IntelliJ also has a more complex mapping of carets to editors, so the Cursive version now handles multiple cursors correctly.

cfleming 2017-10-16T01:58:25.000036Z

See here for another case which requires extra holding locations which aren’t actually carets: https://clojurians-log.clojureverse.org/parinfer/2017-08-30.html

chrisoakman 2017-10-16T01:58:41.000033Z

I think someone mentioned to me at the Conj that they sometimes had trouble with multiple cursors + atom-parinfer

cfleming 2017-10-16T01:58:57.000049Z

Yeah, it won’t work correctly.

cfleming 2017-10-16T01:59:43.000016Z

It’s not too hard to fix, though, I have the fix here - we’ll need to sort out which of all these modifications I’ve made should go back into parinfer mainline, and in which order.

chrisoakman 2017-10-16T02:00:53.000034Z

That sounds good. I know Shaun was working on his talk for like months. Did not have much bandwidth for other things.

cfleming 2017-10-16T02:01:08.000063Z

Yeah, I think so.

seancorfield 2017-10-16T02:34:44.000071Z

I think the only area where I see problems with smart mode in Atom is when I use paredit slurp/barf. If I remember to switch to paren mode first, it's fine. And mostly smart mode is fine with slurp/barf. Just sometimes it messes up the code (changes the paren structure). And it does it in a way that can't be undone (`undo` seems to lose track of the changes -- presumably because of some interaction between paredit and parinfer?).

seancorfield 2017-10-16T02:36:10.000100Z

I might just give up using paredit for a while and see what I lose 🙂

cfleming 2017-10-16T03:07:35.000109Z

@seancorfield Right, it tends to mess up when using operations which cause multiple edits. Wrapping is also bad (see https://github.com/shaunlebron/parinfer/issues/176)

shaunlebron 2017-10-16T05:13:00.000041Z

i got some negative feedback at the conj

shaunlebron 2017-10-16T05:13:58.000080Z

elena approached me and told me parinfer seemed to be a tool for experts, saying that parinfer in nightcode was a disaster for her students

shaunlebron 2017-10-16T05:16:22.000075Z

and another approached me to clarify that parinfer in fact makes whitespace significant in clojure, and seemed dumbfounded at why

shaunlebron 2017-10-16T05:18:47.000067Z

seems similar to the feedback here: https://www.reddit.com/r/Clojure/comments/765tfa/inspiring_a_future_clojure_editor_with_forgotten/doceve9/

dominicm 2017-10-16T06:18:40.000259Z

I can't help but feel like the whitespace is simply wrong. Parinfer makes the code balance with how it looks. Unless you're writing code that's just really badly indented. I'm wondering if some are going to interpret Rich's comment to be about parinfer.

dominicm 2017-10-16T06:27:04.000128Z

I'd be curious to know if Elena thought there was a particular point people are struggling with?

dominicm 2017-10-16T06:29:05.000033Z

http://www.reddit.com/r/Clojure/comments/765tfa/-/dod4mq8 seems like some use it with beginners too.

cfleming 2017-10-16T06:44:41.000003Z

@shaunlebron Did Elena expand on why it was difficult for them?

cfleming 2017-10-16T06:45:40.000001Z

I’m not sure I agree that what Elena is saying is similar to that Reddit subthread. That seems to be more along the lines of “people should just harden up and learn paredit”.

cfleming 2017-10-16T06:47:54.000192Z

Actually, re-reading what you wrote perhaps you were referring to what the other person said.

shaunlebron 2017-10-16T07:48:45.000243Z

she didn’t expand, but we agreed to connect later

shaunlebron 2017-10-16T07:49:53.000179Z

yeah, I was referring to what the other person said

chrisoakman 2017-10-16T14:17:42.000238Z

@dominicm "I'm wondering if some are going to interpret Rich's comment to be about parinfer." --> reddit thread asking this question where I commented: https://www.reddit.com/r/Clojure/comments/75yc7c/opening_keynote_rich_hickey/doc3r2t/

dominicm 2017-10-16T14:24:45.000156Z

@chrisoakman I'm glad you got that cleared up

👍 2
rgdelato 2017-10-16T14:36:30.000303Z

glad to hear that the conversation with Rich seems to have gone well :D

😄 1
chrisoakman 2017-10-16T14:42:59.000727Z

He is a fan of Parinfer. Thinks it's great work.

👍 2
🚫 1
rgdelato 2017-10-16T14:46:50.000441Z

also, I don't know that I would put too much stock in comments from power users on Reddit, particularly those who are already accustomed to using key commands for everything

shaunlebron 2017-10-16T14:55:25.000225Z

lol, Rich did not say he was a fan of Parinfer

shaunlebron 2017-10-16T14:56:44.000845Z

he said he was looking forward to the history part of the talk, and that he wasn’t talking about Parinfer when he said “par-whatever… it’s a terrible idea”

chrisoakman 2017-10-16T15:00:46.000528Z

I remember him saying something like "It's great work"

chrisoakman 2017-10-16T15:02:02.000903Z

On a totally unrelated, meta note: this is a perfect example of how human communication is difficult. We were literally in the same conversation and remember different things 😆 🙃

shaunlebron 2017-10-16T15:02:40.000272Z

haha, /shrug

shaunlebron 2017-10-16T15:03:09.000293Z

i was just happy he didn’t hate it

chrisoakman 2017-10-16T15:03:40.000727Z

Yup. He definitely does not hate Parinfer.