[mercury-users] Record syntax

Dominique de Waleffe ddw at miscrit.be
Thu Jan 20 20:18:50 AEDT 2000


> The compiler only allows a single function with a given name
> and arity in each module.

>
> One desirable feature of record syntax is that changes to the
> representation of a type which cause an attribute to be computed
> on demand by a user-defined function, rather than stored in the
> type, shouldn't require changes to the uses of the attribute.
>
> If multiple fields in a module were allowed to have the same name
> that wouldn't always be possible, because the user-defined functions
> would need to have different names.

OK I had not looked at this aspect.

But I really think that this more complex case is much less frequent than
the simple use of field names to get/set attributes in records. I really
would not mind to have to write different function names for defining
special behaviour for certain attributes given some clean rules on how to
build those names.

So I think that the option has been chosen with the wrong priorities. It
would be simpler for most cases to be allowed the same field names in
several types of a module and provide for recognition of special rules for
making user defined accessors when needed. Of course I don't want to
disallow the user defined accessors.

Mercury is sufficiently verbose as it stands that there is no need to add
yet more to it.

D.






--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list