On Tue, Jan 31, 2012 at 12:15:17AM -0800, Darren Duncan wrote:
> You said, "provided said call does not throw an exception".
> 
> So does that mean you have also promoted some runtime exceptions to
> compile time exceptions, or inlined the exception toss?
> 
> That would be useful.  You don't have to wait until runtime to know
> that the code is going to die unconditionally.
> 
> So constant folding can then work like this:
> 
> 1.  If no exception will be thrown when using the constant arguments
> you have, replace the call with the result value as per usual.
> 
> 2.  If an exception will certainly be thrown when using the constant
> arguments, then either:
> 
> 2a.  Where you would otherwise have put the folded result, place a "fail"/etc.
> 
> 2b.  Throw an exception at compile time.
> 
> Generally speaking, the more kinds of errors you can catch at
> compile time, the more reliable your program is.

Suprisingly I think this is a good idea.  Implemented.  (2b)

-Stefan

Attachment: signature.asc
Description: Digital signature

Reply via email to