-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add "require" tag to specify minimum required re2c version #153
Comments
I see two problems with this proposal:
Do you have a specific example that doesn't fall into one of the two categories? |
Well, without strict ordering such protection would not be complete. However if user will stick to numbers assigned by you only, or to numbers from his Linux distribution, this will work. This is probably the "best effort" here. BTW, bison has option like this. I also saw some flex lexer which used preprocessor to check flex version, so similar option in re2c would have its use too. I also wonder if new configuration option will be added for every new feature - some of them may be backward-compatible, i.e. generated code would be the same as from older re2c version if user did not use it. For example, instead of adding new command line switch And last thing - personally I prefer to get error "re2c version x.y is required" instead of "bad option", "syntax error" or anything else - in latter case I would have to spend some extra time to investigate why this does not work and how to fix it. |
The ability to replace any command-line option with an inplace configuration is one of my goals for the next release. This is really useful for projects that use multiple
The problem here is not with backwards compatibility of new re2c versions (new re2c will accept both old code and new code, for sure). It's the old versions that may screw up new code (fail with an obscure error message, segfault, or worse: silently generate incorrect code). By explicitly documenting the need for an option we at least give old re2c a chance to fail with a good error message. These options in fact behave exactly like the "require" directive you propose, but with a more fine-grained control. You have to demand exactly that what you need, not some vaguely defined set of features.
Let me clarify a bit, "syntax error" (and other spurious errors) is what you get when you use a feature, but forget the option or configuration. You would still get the same error if you forget the "require" directive. On the other side, "bad option" is quite clear. Whatever policy re2c uses for new features, switching policies on the fly is the worst thing to do. re2c is an old program and we cannot expect everyone to start using "require" instead of options. |
Command line option provides some level of protection for new features, assuming of course that someone will use "official" way to build product which uses re2c. But if someone will try to execute re2c manually by executing it directly from command line, and do not pass required options, he will see something different than "bad option" - usually some kind of "syntax error". Bug fixes are another story - there are no options to enable or disable them, so user will see either some re2c error, compilation error or (in worst case) some bug during runtime. To summarize, both cases would benefit from this new "require" tag, especially the second one. |
User code may depend on some feature or bug fix added in specific re2c version, so it would be good to somehow specify minimum required re2c version. Attempt to generate code using older re2c version should fail. I propose following syntax:
This code is rejected by current re2c version, so it will also prevent use of older re2c versions which do not implement this syntax. Please add this.
The text was updated successfully, but these errors were encountered: