You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As breakOut is considered unsafe in some contexts, e.g. in conjunction with a use of forever in the body of a tower task, it seems reasonable to consider this an effect to be tracked, rather than removing it from the language. If it's an effect, than it's still something that can be used by programmers, but restricted by API designers.
Defining an effect for break would yield a new signature for the breakOut function:
breakOut:: (CanBreakeff) =>Ivoryeff()
Thus registering the requirement for a context that allows the breakOut function to be used. This has an added side-benefit of making it impossible to write functions where breakOut is used in a nonsensical position, as presumably only looping functions would introduce the CanBreak effect locally.
WIth this change to breakOut, the tower task loop example changes so that the argument that it will pass to forever has a very restricted context:
taskBody:: (outer `AllocsIn` s)
=> (forallinner. (inner `AllocsIn` s) =>Ivoryinner())
->Ivoryouter()
taskBody body =do...
forever body
As you can see, the taskBody function takes an argument that only permits allocation effects, thus preventing uses of ret, and breakOut, as the new restrictive inner context will not permit them to be used.
The text was updated successfully, but these errors were encountered:
As
breakOut
is considered unsafe in some contexts, e.g. in conjunction with a use offorever
in the body of a tower task, it seems reasonable to consider this an effect to be tracked, rather than removing it from the language. If it's an effect, than it's still something that can be used by programmers, but restricted by API designers.Defining an effect for break would yield a new signature for the
breakOut
function:Thus registering the requirement for a context that allows the
breakOut
function to be used. This has an added side-benefit of making it impossible to write functions wherebreakOut
is used in a nonsensical position, as presumably only looping functions would introduce theCanBreak
effect locally.WIth this change to
breakOut
, the tower task loop example changes so that the argument that it will pass toforever
has a very restricted context:As you can see, the
taskBody
function takes an argument that only permits allocation effects, thus preventing uses ofret
, andbreakOut
, as the new restrictiveinner
context will not permit them to be used.The text was updated successfully, but these errors were encountered: