[m-dev.] special module initialisation code

Peter Schachte schachte at cs.mu.OZ.AU
Fri Mar 31 16:54:54 AEST 2000


> Typically I solve this problem by making the delcarative interface do
> the initializtion.  This can be done in the equivalent of the data
> structure initialization function (if you thread a data structure to
> each operation).
> 
> Alternately, if there is no data struction initialization, you can do a
> "first-time" test for each operation.  It's not clear whether this would
> be too expensive for your application.

Definitely too expensive.

As far as I can see, the two choices are:

	1) Make the interface include an impure init procedure which the
	   documentation makes clear must be called before anything else in
	   the module.

	2) Add the sort of facility you proposed to Mercury and use it.
	   Much, much nicer.  Much, much more work.

	3) ;-) rework the module so you can initialize it statically.


-- 
Peter Schachte                     There's nobody getting rich writing
mailto:schachte at cs.mu.OZ.AU        software that I know of.
http://www.cs.mu.oz.au/~schachte/      -- Bill Gates, 1980 
Phone:  +61 3 8344 9166            
Fax:    +61 3 9348 1184            
--------------------------------------------------------------------------
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