[MLton] behavior of forceUsed

Stephen Weeks MLton@mlton.org
Thu, 5 Aug 2004 16:52:57 -0700

> What do people intuitively believe (or want) the forceUsed annotation to
> do in the following situation:
> 3) everything that was introduced in the scope of the forceUsed and
>    is in the environment scope at the end of the forceUsed scope
>    is forced to be used.  Under this scenario, only Z and Z.z will be
>    forced.  Hence, Y, Y.y, and Z.zz will be warned as unused.
> The current behavior is 2, although I think it would be more natural to
> have the behavior be 3. 

I strongly prefer 3, which I will restate as: in "ann forceUsed in
bdec end", every binding in the basis to which bdec elaborates is
marked as used.

> Although, I don't quite know how to implement it.

Off the top of my head, I would think a localAll for evaluating the
bdec, and then a call to forceUsed before popping out of the local,
with a modification of forceUsed that looks at the scope in the head
of the Values.t and only does the force if the scope stored there
matches the current scope in the env E.

The information's gotta be there somewhere, since localAll knows how
to remove the current scope once the local is exited.