Roedy said:
The place I have run into where a preprocessor would be nice was when
where you had two libraries that implemented a class. You wanted
variable import statements.
I can see why you would want conditional compilation in this case, but I
dislike the general approach. If implementations are provided in
different libraries then, IMO, they should implement a common interface,
be typed with that interface inside any program that cared to use them
interchangeably, and in such programs be instantiated reflectively. The
specific class name to use need not appear in the source at all -- the
most flexible approach would put it in a configuration file for the
application, or possibly read it from a system property defined at JVM
startup. There is then no need for conditional compilation and, IMO,
the situation is rather clearer (if a bit more complex).
John Bollinger
(e-mail address removed)