[m-dev.] record syntax

Dominique de Waleffe ddw at miscrit.be
Wed Nov 29 21:26:17 AEDT 2000


> > 
> > Yes: the interface needs to specify the field types.
> > 
> > Are you aware of the existing syntax for this?
> > 
> Yes, but I find the verboseness to be a big drawback.
> 
> How about 
> 
> :- type abstract(T) with [field_a :: int, field_b :: int].

I agree with Peter that the current possibility is too verbose,
but why introduce a new syntax? 

Can't something like

:-interface.
:-type xx(T) ---> xx(field_a::int,field_b::int).

:-implementation.
% version A
%    -this just adds one more field, unexported accessors, to the XX() type
%    -what's the order of fields when accessing as xx(X,Y,Z) ?
:-type xx(T) ---> xx(field_c::int).
% Version B
%    -in this case the order would be fixed, but can it be changed 
%    in the interface decl.
:-type xx(T) ---> xx(field_c::int,field_a::int,field_b::int).

suffice?

D.

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