Charles Fiterman <cef@geodesic.com> writes:> I think for partial evaluation to be useful in an imperative language> there must be language constructs to support it.

Seems sensible to me also. And not only for imperative languages.

> frozen variable-list;> The following variables are frozen, they have reached their final state.

I'd rather see something like a "freeze" operation that can be applied to a
variable. Still, checking its validity can be tricky (seems about as hard as
infering "freeze" operations automatically). Moreover, if the check cannot be
done (or isn't done), trusting the programmer might introduce unsafety (just
like any other kind of cast, it seems).

These seem kind of hackish to me. What you really want is not "do this
when I compile the stuff", but "please compute that in advance". The
point is that the "in advance" can be at compile-time, at link-time,
at run-time (with run-time code-generation for instance), ...

> I regard strong typing as partial evaluation of the type system in> such a way that no errors may occur at run time. But there are many> times we don't want errors at run time. I don't ever want to hear> "Is there a programmer aboard the aircraft? I'm getting the message> 'zero divide error'"

I agree that languages should provide a way for the programmer to
differentiate between exceptions that can happen and exceptions that
should not happen no matter what (i.e. errors; such as array-bounds
violation). This latter can be used a lot more agressively by the
compiler since it doesn't have any precise semantic (apart from :
"please crash soon enough"). The "best" way to handle this is by
propagating the possible handlers everywhere and checking whether some
exception might be handled (in this last case, it should be treated as
a real error). One more global analysis.