[m-dev.] record syntax
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Nov 30 01:03:31 AEDT 2000
On 29-Nov-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> On Wed, Nov 29, 2000 at 09:39:19AM +1100, Fergus Henderson wrote:
> > On 28-Nov-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> > > I think we should add the following to the record syntax for allowing
> > > the use of the record syntax for abstract types.
> > >
> > > :- interface.
> > >
> > > :- type abstract(T) with [field_a, field_b].
> > >
> > > :- implementation.
> > >
> > > :- type abstract(T)
> > > ---> f(
> > > field_a :: int,
> > > field_b :: int,
> > > field_c :: int
> > > ).
> > >
> > > Any objections?
> >
> > 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].
Better, but that still doesn't specify the determinism of the field
access functions. Note that field access functions can be semidet
(e.g. for discriminated types with more than one alternative).
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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