Simon Peyton-Jones wrote:
>a function with an assert that always fails
>is indeed a good candidate for a compile-time error message.

When I developed compilers for Fortran and C++, from time to time we would
get reports from customers that the compiler had failed to diagnose an
error in their code.  On a couple of occasions when a developer would agree
with the customer and put in a check for the error, the fix turned out to
be wrong in an interesting way.  We would get bug reports from all of the
customers whose code had dead sections containing the "error".  This can
happen when a compiler naively attempts to diagnose at compile time, errors
which are defined by the language for execution time.  

I'm skeptical of whether "always fails" could be defined in a way that's
both portable and meets users' expectations.

>It would be quite reasonable to have some way
>to tell the compiler 'evaluate this to a static value'.   I'd suggest
>doing it via a pseudo-function
>       static :: a -> a
>which behaved like the identity function, except that it evaluated
>its argument rather eagerly at compile time.

AFAIK eagerness isn't addressed by the Haskell language.  Since Mechveliani
is primarily concerned with compile-time diagnostics rather than
efficiency, wouldn't eagerness be irrelevant?

--
Scott Turner
[EMAIL PROTECTED]       http://www.ma.ultranet.com/~pkturner

Reply via email to