[m-dev.] record syntax

Ralph Becket rbeck at microsoft.com
Thu Dec 7 22:26:37 AEDT 2000


>From Peter Ross on 29/11/2000 14:24:53
> > 
> Easy to solve, I will only allow this syntax on du types with one
> alternative. ;)  This may also be the best solution.  I am not sure that
> an abstract type whose underlying representation is a du type with more
> then one alternative should be using the record syntax.  It seems to me
> that the user should be defining their own interface to the type.
> 
I disagree, especially in the light of the discussions on extending
field access syntax to handle parameters, as in

	Map ^ value(Key)
	Map ^ value(Key) := Value

The Map object may well belong to a type that has several constructors
(e.g. tree234).

I don't actually find the need to write

:- func field_a(T) = foo.	:- func 'field_a:='(T, foo) = T.
...

to be that big a deal.  It certainly wouldn't be hard to write a small
shell script (or Emacs function, if you're that way inclined) to knock
out the boilerplate for you.

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 

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