Hey

On Tue, Feb 10, 2015 at 2:47 AM, Xinchen Hui <larue...@php.net> wrote:
>
> why make this thing in this way complicated? why not just simply
> include the generated files as others did?


First of all the others did exactly what I have already done. :) It means
they included re2c generated files and did not include bison generated
files.

There are few reasons why I would like to do it slightly differently in
json and make the re-generation optional.

1. I want to prevent an accidental re-generation of files with the old
version of re2c and bison. It happens to me from time to time when I switch
branches and build often. Then I see that I have changes (git diff) in the
zend_language_scanner.c and other re2c generated files even if I haven't
edited them. The reason is because the version that I use is different and
the files got regenerated (you won't see that if you use the same version).
That could be even bigger problem with bison where the the version
differences are much more often.

2. As soon as I start using new features (like utf8 ranges in re2c) that
are not available in the old version and someone would try to do some
changes in the scanner and regenerate it, then it would fail with error. I
believe that it's better if the user gets a warning during the
configuration and the compilation exits the build instead of generating an
error.

3 It is sort of a signal which version is currently supported and it
hopefully prevents things like regenerating files with the old version and
pushing it to the repo (as Anatol did yesterday in
https://github.com/php/php-src/commit/89893541305594eba373c15156eb54d7a7cb5960
).


As I said in the PR. This change won't affect anyone who doesn't change
json scanner and parser which is 99% of all users that build PHP. The 1% is
probably just me so it's not really complicated IMHO...

I would also like to add all of this to the json README (it's very outdated
and I plan to update it anyway) and possibly other build doc if we have any.

Cheers

Jakub

Reply via email to