Hacker News new | past | comments | ask | show | jobs | submit login

This is a topic I've been contemplating heavily and it's very instructive to see the iterative progress you've made here.

I think development tools like this are necessary to expand coding outside of just the desktop experience. For example, I've seen kids program some pretty impressive robotics with just a touchscreen and Blockly.

Also, from a compilers perspective, it feels almost absurd to rely on plaintext. Imagine how much harder code merging is using line diff compared to diffing syntax trees.

Thanks for sharing!




for diffing syntax trees, I've been trying out diffsitter, and it feels pretty good so far

https://github.com/afnanenayet/diffsitter


Diffing is really an interesting point. Git is quite (maybe very) good. I wonder how much better a structured approach could be but it's obviously a large amount of work that I don't yet have time for.


Plain Text diffing has some obvious drawbacks:

1. If you rearrange your functions you will see a lot of additions and deletions while semantically there is no change in the program. It's just noise.

2. If you rename a variable you don't really have any actual change in places where it is referenced but text diff will again show a lot of noise. But the code references is still the same code.


At least to me whitespace does convey meaning and order of functions or variable renaming definitely conveys a semantic change.


> variable renaming definitely conveys a semantic change

I didn't say it doesn't. Renaming is a change and you see it but you don't need to see it in every place that refers to that variable. For them there is simply no semantic change they still reference the same variable.

> At least to me whitespace does convey meaning

Can you give an example? If two programs behave exactly the same how whitespace convey a semantic change?

> order of functions

You can see order changes in a structured diff as well if you want but you don't need to hundreds of line of removal and addition like text diff. You would see only the relevant thing which is reordering.


> Can you give an example?

In C, I use FOO() for a macro, foo() for a function like macro and foo () for a function.

Also:

  statement1;
  statement2;

  statement3;
  statement4;
is different from:

  statement1;

  statement2;
  statement3;

  statement4;
Can you still see those changes in a structured diff?

> You can see order changes in a structured diff as well if you want but you don't need to hundreds of line of removal and addition like text diff. You would see only the relevant thing which is reordering.

That is nice then, I thought diffing an AST would lose that ability.


Modern SmallTalks have the option to save off a hierarchy of classes to text in order to use modern version control, and also to apply these exports to a running image. This should be even easier for traditional languages with no live running environment. There's no reason whatever structure editor you use can't export a normalized text representation so that you can still use it with Git


> the option to save off a hierarchy of classes to text

And so did ancient Smalltalks.

1984 "Smalltalk-80 The Interactive Programming Environment" page 46

"Within each project, a set of changes you make to class descriptions is maintained. … Using a browser view of this set of changes, you can find out what you have been doing. Also, you can use the set of changes to create an external file containing descriptions of the modifications you have made to the system so that you can share your work with other users."

https://rmod-files.lille.inria.fr/FreeBooks/TheInteractivePr...


I did not realize this! Thanks for sharing.


Git (or whatever does the diff under the hood) is _adequate_. Every week I see diffs that are confusing, especially during merge conflicts, it’s honestly a bit embarrassing that in this day and age we don’t have anything better for something that is so central to our job


A structured approach would be able to easily do things like ignore when a symbol was renamed (since that wouldn't affect the tree structure). So there are good reasons for wanting to do it that way, vs. a line-based diff.


You could run a parser in the diff tool without using a structured editor, though.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: