[m-dev.] record syntax
Peter Ross
peter.ross at miscrit.be
Thu Nov 30 01:19:46 AEDT 2000
On Thu, Nov 30, 2000 at 01:03:31AM +1100, Fergus Henderson wrote:
> 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).
>
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.
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