Session exceptions are compiled into effects and handlers. A practical difficulty with this is that code can become polluted with the SessionFail effect. Moreover, if session exceptions are switched on then the typing rules for all of the spawn operators change to take into the SessionFail effect (see core/lib.ml). This PR adds an experimental setting expose_session_fail which defaults to true (giving the old behaviour), but when set to false will hide the SessionFail effect as part of the built-in wild effect.
The PR is technically incomplete as it does not include special cases for treating SessionFail in the IR type checker when expose_session_fail is disabled, but it is safely hidden behind an experimental setting and is already sufficient to use for practical examples - and in particular makes it possible to implement functionality for detecting when a browser window closes in MVU applications which are not compatible with the SessionFail effect appearing explicitly in types.
Session exceptions are compiled into effects and handlers. A practical difficulty with this is that code can become polluted with the
SessionFail
effect. Moreover, if session exceptions are switched on then the typing rules for all of the spawn operators change to take into theSessionFail
effect (see core/lib.ml). This PR adds an experimental settingexpose_session_fail
which defaults totrue
(giving the old behaviour), but when set tofalse
will hide theSessionFail
effect as part of the built-inwild
effect.The PR is technically incomplete as it does not include special cases for treating
SessionFail
in the IR type checker whenexpose_session_fail
is disabled, but it is safely hidden behind an experimental setting and is already sufficient to use for practical examples - and in particular makes it possible to implement functionality for detecting when a browser window closes in MVU applications which are not compatible with theSessionFail
effect appearing explicitly in types.