Matthias Kilian wrote:
> It doesn't. There's no special treatment of constant conditionals, except
> that clever (or rather a not totally braindamaged) compiler may be
> expected to optimize the unreachable branch away. At least this is what
> several Java books say.
Yes, you seem to be right. Nevertheless what Java does isn't really
relevant. I think such a feature, for Haskell,
would be cleaner than the current combination of Haskell + CPP, though as I
said it's nasty.
Obviously you need rather more than boolean conditionals if you are having
to run something under both Haskell 98 and Haskell 1.3. This is not my
current situation in the Real World, which is trying to get something to
run under the latest versions of Hugs and GHC. But I don't like the
idea of having general syntax extensions (disfix operators or whatever)
added to the language as a whole; it just encourages programmers to
develop their own incomprehensible dialect of the language. So while
people who have to support obsolete versions of languages have my sympathy
(qv C programs which are written to cope with both ANSI and K&R C), I
wouldn't want a universally-available preprocessor to be too powerful.