[m-dev.] record syntax

Peter Ross peter.ross at miscrit.be
Wed Nov 29 21:52:28 AEDT 2000


On Wed, Nov 29, 2000 at 11:26:17AM +0100, Dominique de Waleffe wrote:
> > > 
> > > 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?
> 
The major problem with this approach is that by looking at the
interface, it is no longer clear that it is an abstract type and hence
the user might try and construct/deconstruct the type.

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