noprompt/ankha

Differences!!

Closed this issue · 9 comments

It hit me last night that what's missing from EDN renderers is Differences! That's what we are looking for right? Differences is something we as ClojureScript developers should be able to do very well.

As an Atom changes we could render in the traditional red - green pattern:
Red for subtractions.
Green for additions.
For in-place changes we could provide a hover or a link that shows the previous value.

The renderer could have a checkbox that turns difference rendering on and off.

What do ya think?

Aside: Also the reason I am using my own renderer in Devcards (I wrote it before I knew about Ankha) is that I wanted it to work well inside and outside of Om. I'm still struggling to make things that work well on both. Using React as the base I get both platforms. This could be a misunderstanding on my part.

yazz commented

Fantastic idea. I would love having red and green for additions and
substractions!

On Tue, Jun 10, 2014 at 6:31 PM, Bruce Hauman notifications@github.com
wrote:

It hit me last night that what's missing from EDN renderers is
Differences! That's what we are looking for right? Differences is something
we as ClojureScript developers should be able to do very well.

As an Atom changes we could render in the traditional red - green pattern:
Red for subtractions.
Green for additions.
For in-place changes we could provide a hover or a link that shows the
previous value.

The renderer could have a checkbox that turns difference rendering on and
off.

What do ya think?

Aside: Also the reason I am using my own renderer in Devcards (I wrote it
before I knew about Ankha) is that I wanted it to work well inside and
outside of Om. I'm still struggling to make things that work well on both.
Using React as the base I get both platforms. This could be a
misunderstanding on my part.


Reply to this email directly or view it on GitHub
#7.

I like this idea a lot. It could be a little tricky though. How do you suppose we go about it?

yazz commented

I haven't looked at the Ankha code yet, so I do not know how this would be done. I will have to find the time to go through it first

@bhauman Any thoughts?

Yeah I have a couple of thoughts,
you can simplify the problem and use willRecieveProps to test if the current value is being changed and add a class to the ReactElement. This won't give you additions or removals but should give you some helpful feedback. Well this could give you addition and removal if you "pad" previous and incoming collections to the same size with some Empty objects.

Or you could do a first pass through the previous whole collection and the incoming collection and annotate it. And then include conditions in your parser to handle the annotations. This would require storing the previous collection.

On Jun 12, 2014, at 11:00 AM, Joel Holdbrooks notifications@github.com wrote:

@bhauman Any thoughts?


Reply to this email directly or view it on GitHub.

I am out and about today so I wrote that pretty quickly. Does it make sense?

On Jun 12, 2014, at 11:00 AM, Joel Holdbrooks notifications@github.com wrote:

@bhauman Any thoughts?


Reply to this email directly or view it on GitHub.

@bhauman It makes sense but the implementation sounds like it could be a little heavy. My gut tells me ankha/inspector should only be concerned with displaying data and nothing else. It seems reasonable to have a function which computes a diff and returns a data structure with reifyed instances of ankha/IInspect (or records for DiffInsertion, DiffDeletion, etc. with the implementation) instead of modifying too much the ankha/inspector.

@bhauman Any more thoughts? If you'd like to pull this discussion in to a Hangout or something we could have a friendly chat about improving the Om/ClojureScript inspection space.

Hey Joel,

Yeah this really isn't an issue. I just wanted to share an idea that hit me while I was working the other day. A google hangout sounds great. :)

Feel free to hit me up.