links-lang / links

Links: Linking Theory to Practice for the Web
http://www.links-lang.org
Other
318 stars 42 forks source link

Hide session fail #1167

Closed slindley closed 1 year ago

slindley commented 1 year ago

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.