[mercury-users] switch detection

Ralph Becket rafe at csse.unimelb.edu.au
Tue Jan 9 10:52:59 AEDT 2007


Nicholas Nethercote, Tuesday,  9 January 2007:
> It's not a hard workaround, but it was a little surprising (Mercury's
> switch-detection is normally pretty good) and I thought it worth
> mentioning.

What's happening here is that switch detection only looks at
unifications and not function calls, which is what field accesses are.
The solution is to move the field access outside the switch and use
a temporary variable, e.g.:

	L = S ^ lang,
	(
		L = ...
	;
		L = ...
	;
		L = ...
	)

-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list