[mercury-users] Syntactic sugar for higher order types and mode s

schachte at cs.mu.OZ.AU schachte at cs.mu.OZ.AU
Fri Jul 21 20:55:29 AEST 2000


On 21 Jul, Fergus Henderson wrote:
> On 21-Jul-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
>> My suggestion is no operator at all.
>> 
>> :- pred foo bar.
>>
>> This is completely the same as the syntax for predicate types (and
>> modes) and is how we use equivalence types everywhere else (no special
>> operators or syntax, just use the equivalence wherever you would
>> normally put the equivalent type).
> 
> Well, it's not really the same as the existing syntax for
> predicate types and modes; if the current syntax were
> 
> 	:- pred foo1 pred(int, int).
> 	:- func foo2 (func(int) = int).
> 
> then what you suggest would make perfect sense, but the current syntax
> is a little different than that, so it's not "completely the same".

OK, so make it the same.  Permit this syntax for declaring a function
or predicate type name:

	:- type foo1 == (int, int).
	:- type foo2 == (int) = int.  % ... int = int looks odd.

Then it is the same as the existing syntax, except for the space.

It all looks a bit odd, until you start thinking of a tuple as a
built-in structuring facility (which would be useful in its own right).
Then you can look at higher order function or predicate call as just
applying a closure to a tuple.

-- 
Peter Schachte                     The use of COBOL cripples the mind; its
mailto:schachte at cs.mu.OZ.AU        teaching should, therefore, be regarded
http://www.cs.mu.oz.au/~schachte/  as a criminal offense.
PGP: finger schachte at 128.250.37.3      -- E. W. Dijkstra 

--------------------------------------------------------------------------
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