[mercury-users] Syntactic sugar for higher order types and mo des
Ralph Becket
rbeck at microsoft.com
Wed Jul 26 03:49:46 AEST 2000
[Hauling myself back off the sick-bed to rejoin the discussion]
I agree that the conjectural syntax I proposed was mildly horrid,
but I would like to see the facility in the language.
Most of the debate seems to have revolved around the fact that
Mercury has an embarrassment of equality and membership symbols.
We have...
= for unification, function signatures, inst definition
== for type equivalence
:: for mode definition, inline mode membership
How about this instead:
= for unification and function signatures
== for definitions (type, mode, etc.)
: to denote membership (type, mode, etc.)
__ or . for module name resolution (as God intended)
So we would write
:- type nat == int. % Just for kicks.
:- type filter_func(T) == (func(pred(T), list(T)) = list(T)).
:- mode filter_mode == (func(pred(in) is semidet, in) = out is det).
:- func foo : filter_func(char).
:- mode foo : filter_mode.
:- func bar : filter_func(int).
:- mode bar : filter_mode.
We might retain :: for inline type-and-mode specification:
:- func baz : (filter_func(string)::filter_mode).
Precedences could be changed to do away with the need for unwanted
parentheses. Use of : for module name resolution is an affront to
good taste, says Ralph.
I, for one, would quite like to see a bit of pruning of the equivalence/
definition/membership symbols in Mercury, several of which seem to exist
in their strange forms mainly for hysterical raisons.
Cheers,
Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list