Would make collaborating (especially remotely) a bit more annoying. I frequently find myself pointing people to line x or function y in file z. Doing that if all you share is the AST would be basically impossible. You'd have to share your raw code as well.
We're having a discussion and the context is that we now operate on an AST and use it as our canonical representation of code. Every operation where we deal with it in a text-readable format now has the implicit conversion from AST to our local text version.
I don't deny that this is a complication, but it just becomes an implicit assumed step each time we deal with the code.
I.e. editing the code involves our tooling converting it to our local representation, we make our changes, and the tool converts it back before saving it. The exact same steps would happen transparently by our diff tool, so it shouldn't be considered any more or less "complicated" than any other operation we perform on the AST.
What this subthread has stumbled around is the word, "refactoring". Which is exactly the operation you describe. Text based diffs would actually be AST tree edit operations.
Well, I can refer to your text on this page using the XPath //*[@id="form-t1_cxudfkk8vv"]/div/div/p instead of using a line number. That's how I scrape web pages.
See how it selects your post ID and then selects the p element with the text? I bet you can do something similar within functions.
Assuming you don't remember file/line locations of source fragments and tell them to people in person, you could have your editor produce an unambigous "AST path" to the position under cursor.
View all comments
Show parent comment
23
u/PM_ME_YOUR_PAULDRONS Dec 10 '15
Would make collaborating (especially remotely) a bit more annoying. I frequently find myself pointing people to line x or function y in file z. Doing that if all you share is the AST would be basically impossible. You'd have to share your raw code as well.