[E-Lang] Internal vs. external iteration

Tyler Close tclose@oilspace.com
Wed, 28 Mar 2001 09:00:54 +0100


> Hi Dean -
>
> > construct actually needs to throw an exception.
> Depending on the Java
> > implementation, throwing an exception can be stunningly
> more expensive
> > (*100-*1000) than returning or breaking.  Some of the forces are:
>
> AFAIK, on most implementations, large parts of the cost of
> throwing an
> exception come from having to create the stack trace that goes along
> with it.
>
> If you are using the act of throwing an exception to simulate a
> control-flow structure then you are typically not interested in the
> stack trace.  So its possible to use a set of pre-created (at system
> startup ?) exceptions for this sort of thing.

Hydro does not use exceptions for loop flow control. The client code
closure is supposed to return a boolean indicating whether or not it
would like to terminate the inspection. Therefore a "break" would
compile to "return true"; otherwise, you return false. See:

"http://www.waterken.com/Hydro/2.0/doc/com/waterken/canal/Source.html#
inspect(com.waterken.canal.Inspector)"

I didn't realize that E uses exceptions for loop flow control. Yuck.

Tyler