[m-dev.] Suggestion for a new "where" operator

Ralph Becket rafe at cs.mu.OZ.AU
Mon Aug 4 14:50:16 AEST 2003


There have been many occasions where I have needed to use a predicate to
compute the result for a function or an expression, in situations where
it has been awkward or impossible to do so without resorting to
predicate syntax instead.  This problem commonly arises in if-then-else
expressions.

I'd like to propose a new bit of syntactic sugar which I'll call "where
expressions".

The idea is that an expression (E where G) denotes the expression E
computed using the goal G.  This will be expanded out in make_hlds as

	G,
	X = E

where X is the variable being unified with the result of the expression.

Any comments?
-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list