Wed, 17 May 2000 13:42:22 +0400 (MSD), S.D.Mechveliani <[EMAIL PROTECTED]> pisze:
> The "human" compilation detects that h and h' yield (error..)
> for each argument ys.
> In many cases, the programmer would like the compiler to stop
> compiling N and report something like
> Error: h always yields (error...).
It can be a warning, but without introducing some new syntax it cannot
be an error. When authors of GHC's Prelude wrote:
errorEmptyList:: String -> a
errorEmptyList fun =
error (prel_list_str ++ fun ++ ": empty list")
they knew that it will always yield error, this was exactly what they
wanted, and this is a correct program.
Moreover, IMHO it would be bad to _require_ from implementations
to be able to unfold any expression to a given level, i.e. have an
interpreter inside each compiler. And the notion of level is not
fixed. How many levels it takes to unfold an application of sum?
So an ideal place for these compile-time assertions is optional
warnings, produced without special annotations from the programmer.
A compiler already has freedom to evaluate constant operations at
compile-time and to give warnings for correct code that looks as
programmer errors - many already do. A good compiler can heuristically
spot applications of functions that not always yield bottom to values
for which they always do yield bottom.
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-