FW: [mercury-users] Records

Ralph Becket rbeck at microsoft.com
Tue Nov 2 22:24:09 AEDT 1999


I have another question about records.

When I did something a bit like this a while back (with an Awk script) I
decided I also had to be able to cope with the following:

* read-only fields
* private fields

Extending your syntax, this might look like the following:

:- interface.

:- type foo
	--->	foo(
			f1	::	int,				%
public, read/write
			f2	::	string is readonly	% public,
read-only
	).

:- implementation.

:- type foo
	--->	foo(
			f1	::	int,				%
all fields are
			f2	::	string,			% read/write
in the i'face
			f3	::	float				%
extension to the c'tor
	).

This is all starting to get a little messy.  For it to work (read-only
fields
and extensions etc.) the foo type will have to be abstract - the only way
the
user can gain access to the fields should be through the available field
access methods.

Any thoughts?

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