[m-dev.] tightening up require_complete_switch

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Apr 18 22:26:33 AEST 2016


On Mon, 11 Apr 2016 12:29:27 +1000 (AEST), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> On Mon, 11 Apr 2016 11:31:06 +1000, Peter Wang <novalazy at gmail.com> wrote:
> > Or simply remove the subtlety in require_complete_switch even if
> > that means require_complete_switch could no longer be used in some
> > multi-moded code.
> 
> I will do this in a test workspace and see what problems a bootcheck
> throws up. I don't think this point can be usefully discussed without
> knowing the result.

I have now done this. The bootcheck did not reveal any problems at all.
The only two test cases that failed were (a) a test that checked the exact
wording of the warning we used to generate in this case, and (b) a test
of the fact that the warning did NOT prevent the compiler from generating
target code.

Given this fact, I have no objection to making the compiler generate an error
whenever a require_complete_switch [X] scope is not a switch on X.
The attached diff does this. Given that this is a (slight) change to the language,
I would appreciate everyone's input on it.

I plan to repeat the experiment with the require_switch_arms_detism scopes.
I will report back, but I strongly suspect that the result will be the same,
so I would like feedback on making the same change to that scope in that case.

As for making the [X] part optional, I think that benefit is minimal, while the
cost, in terms of making any error messages about the scope more complex
and therefore harder to understand, a bit (though not a lot) more substantial.


Zoltan.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.rcs
Type: application/octet-stream
Size: 1027 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20160418/28876bf7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.rcs
Type: application/octet-stream
Size: 5646 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20160418/28876bf7/attachment-0001.obj>


More information about the developers mailing list