
John Meacham
too bad we can't do things like
#if exists(module System.Path) import System.Path #else ... #endif
I still find it perplexing that there isn't a decent standard haskell preprocessor....
For my language Kogut I designed a syntax ifDefined condition { something } otherCondition { something else } ... where a condition is an identifier whose definedness is tested, or "module ModuleName" for existence of a module, or _ which is always true, or their combination using conjunctions, alternatives and negations. The construct can be an expression (no condition is true => Null, which makes sense with dynamic typing), a definition (no condition is true => nothing is defined) or a pattern (no condition is true => a pattern which never matches). It does not subsume Common Lisp's #+ and #- nor vice versa. In Lisp it is done at read time, not compile time, which has some advantages, but is incompatible with temporal separation of compilation phases. Even though definitions may in general be mutually recursive, similarly as in Haskell, ifDefined depends only on definitions above it. This is hard to avoid, because its expansion may influence the set of definitions which will be present. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/