[m-dev.] ground >> dead

Mark Brown mark at csse.unimelb.edu.au
Mon Jan 15 22:32:12 AEDT 2007


On 15-Jan-2007, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
> On Mon, 15 Jan 2007, Ian MacLarty wrote:
> 
> >Hi,
> >
> >Is the mode ground >> dead legal?  My intuition tells me it shouldn't
> >be, since you shouldn't be able to clobber something that's not unique.
> >The compiler doesn't complain about this mode however, so is this a bug
> >in the mode system?
> 
> It looks like the compiler doesn't check the modes for sensibility,
> e.g.
> 
> 	:- mode foo == dead >> ground.
> 	:- mode bar == clobbered >> any.
> 
> For the ground >> dead mode can you actually get clauses that use
> this mode to compile?

There's no problem with:

	main(!IO) :-
		p("foo", X),
		write_string(X, !IO),
		nl(!IO).

	:- pred p(string::ground >> dead, string::out) is det.

	p(X, X).

It's hard to see that this mode is useful, however, since it imposes a
restriction on the caller for which there is no corresponding gain (that
I can see).

Cheers,
Mark.

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list