[m-dev.] for review: revised code_info.m diff

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Feb 10 16:21:22 AEDT 2000


On 10-Feb-2000, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> On Thu, Feb 10, 2000 at 12:13:39PM EST, Robert Ernst Johann JESCHOFNIK wrote:
> > On Thu, 10 Feb 2000, Thomas Conway wrote:
> > 
> > > +code_info__get_globals(CI^globals, CI, CI).
> > [etc]
> > 
> > Are these even needed? I thought the point of the record syntax was to
> > remove the need for manual get and set preds..
> 
> Two points:
> 	- code_info is an abstract type.

That's OK; the record syntax lets you keep the type abstract
and still export the accessor functions.

For example, the following module is a valid Mercury module:

	:- module foo.
	:- interface.

	:- type t.
	:- func f1(t) = int.
	:- func f2(t) = string.
	:- func 'f1:='(t, int) = t.

	:- implementation.

	:- type t ---> t(f1 :: int, f2 :: string).

	:- end_module foo.

Note that there is no need to explicitly define the accessor
functions.  Note also that only those accessor functions
declared in the interface will be exported; for example,
in the module above, 'f2:='/2 will not be exported.

> 	- Do you think I'm going to go and change [e]very call to that many
> 	  access predicate? (about 550 calls) :-)

This is a much more convincing point ;-)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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