George Russell <[EMAIL PROTECTED]> wrote,

> Simon Peyton-Jones wrote:
> > One solution is to add
> > macros (presumably in a more hygienic form than cpp), but I'm reluctant
> > to advocate that, because macros undoubtedly do overlap with functions.
>
> You don't need macros.  (For speed purposes inline functions are obviously
> better.)  All you need are (a) a way of defining a
> constant value (restricted to type Integer or Bool say) in
> one file so that it can be used in another file;
> (b) a type of compile-time if statement which will branch
> on simple arithmetic and boolean expressions in constant
> values and constants, which doesn't typecheck the branch
> which isn't taken.  For example, this is what Java
> provides and I think it's not too bad.  (In Java the
> compile-time "if" is indistinguishable from the normal
> one; I'd rather for Haskell it was called something
> different, like _if.)  I think you could get such a
> solution to work; it wouldn't be terribly elegant, but it
> would be a lot more elegant than the current combination
> of Haskell + CPP.

This sounds interesting.  So you want the branch that is not
taken to be syntactically correct, but it need not type
check.  How about other semantic constraints (visibility of
names etc)?  If you want to use this mechanism for selecting
whether or not to use non-standard features, you probably
also have to allow that the branch not taken is
syntactically illegal (eg, use of GHC's unboxed values in
one branch and plain Haskell in the other).  How is this
exactly in Java?

Manuel



Reply via email to