I don't personally agree with this. It's not our problem if users write
ugly code. They've got a 30-year-old language, and they already do this,
all the time, without our help. And they've spent the best part of 30
years asking for a pre-processor. A pre-processor doesn't break the
language grammar, if it's defined as just that - a pre-processor with a
separate grammar. It should have no impact at all on the main language
except for the requirement to handle line directives.
A couple of people have suggested an in-language way to handle
conditional compilation. My own view is that this is not practical in
many cases, and conditional inclusion pretty much has to be handled in a
separate pre-processing text translation phase. I'd really like to hear
from someone else who has actually written compilers what they think
about this. The basic idea is simple. If the user's code is broken in
between two preprocessor directives, then you simply can't carry out any
meaningful analysis on the text stream between those two points; the
compiler will just error out. This is exactly the problem that generate
has, and the reason that the LRM doesn't allow bad code in a generate.
That's why this is done as a separate phase - the pre-processor is much
simpler, it only has to search for known directives, and it can simply
ignore the code in between. In practice, there are some sorts of code
that will catch out a preprocessor, but they're not significant.
-Evan
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Tue Aug 16 07:08:52 2011
This archive was generated by hypermail 2.1.8 : Tue Aug 16 2011 - 07:09:04 PDT