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

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.




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

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

Search: