Hans Aberg writes:

>   I have noted that C++ exceptions (Exception(a), where a is any piece of
> data) can be used to implement dynamic versions of C++ constructs such as
> ``return'' and ``break'' (because I have done it).
> 
>   So exceptions are certainly more general than function returns, at least
> in this context.
> 
>   Hans Aberg


Now, I do not understand that. Certainly one may say that *all* imperative
constructs are more general than "ordinary" function returns (trivial
Monad...), and in particular with the 'C' longjump you may do horrible
things, but if the environment trapping is just used to implement "return",
then I believe that all that can be "functionalized" through continuations.

With -- quite functional -- call/cc in Scheme (or other mechanisms 
dealing with first class continuations) you may implement even more exotic 
control constructs, coroutines, asynchronous message dispatching, etc.
They are still functional, but they include the hidden state transformation.

I believe that Hans standpoint depends on his vision of the *state* of
the system.


**

Yours
Jerzy Karczmarczuk
University of Caen, France


Reply via email to