On Sunday, May 17, 2015 at 7:14:33 AM UTC-5, Edward K. Ream wrote:

>> Beautifying, reformatting or otherwise "improving" code could 
potentially change its meaning.

> Aha: We want a diff that shows only changes that *do *change the hash.

More experimentation shows that solving this problem directly will be 
difficult.

I gave this problem considerable thought yesterday. My conclusion: the 
desired "semantic diff" would have to be driven by one or more passes over 
the ast tree.  There is no way simply to filter output of python's difflib. 
Even now, I have no clear picture of the way forward.

I intend to pursue this project. It is fundamentally important.  However, 
there is an easy way that can be done first. Leo can easily check the 
output of various beautify commands as follows:

1. Take an snapshot of the initial ast tree (or its sha1 hash).
2. Run the beautify command.
3. Verify that the ast tree has not changed.

This is a fundamental check on the workings of any implementation of the 
beautify commands.  I'll do this asap.

*Notes*

Leo's installation notes should mention PythonTidy.  I'll fix this today.

Imo, the code in the core and commands directories should be beautified, 
but two things must be done first:

1. Leo's beautification code contains some idiosyncrasies. I am going to 
review those with an eye towards removing some or all of them.

2. Leo needs several unit tests that verify that beautification handles 
important cases correctly.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to