[m-dev.] Explicit destruction of unique objects

Ralph Becket rbeck at microsoft.com
Wed Apr 11 01:21:25 AEST 2001


I've just been to a talk on the Vault project, concerned with static
detection
of API usage violations.  Their solution is essentially based on the
idea of
uniqueness and existentially quantified types(*), similar to Mercury's,
but they 
require that unique objects be explicitly disposed of.

I think this is a requirement we should add to Mercury because it allows
static
detection of errors such as acquiring locks and then not freeing them
before they
go out of scope (assuming a lock is treated as a unique object).

The destroy operations can still be noops, though they're a good
opportunity for
compile time GC.

At the moment we don't do this: the compiler is happy with the
following...

:- module foo.
:- interface.
:- import_module io, int.

:- pred p(int::in, io__state::di) is det.

:- implementation.

p(X, IO) :- io__write_int(X, IO, _).


- Ralph

(*) Although they pander to the great unwashed by supplying all this
stuff as
syntactic sugar for an imperative language.
--------------------------------------------------------------------------
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