[m-dev.] polymorphic modes

David Overton dmo at hydra.cs.mu.oz.au
Wed Feb 9 23:34:31 AEDT 2000


On Wed, 09 Feb, 2000 at 11:05:24PM EST, Robert Ernst Johann JESCHOFNIK wrote:
> On Wed, 9 Feb 2000, David Overton wrote:
> 
> > > What happens if you call p/1 with a arguments whose
> > > initial insts are `(unique, free)'?  Does that end
> > > up calling the `p(in(ground), out(ground))' mode,
> > > or is it a mode error?
> > > 
> > 
> > The former.
> 
> Is this desireable?
> I think at the very least there should be a warning, letting you know that
> the uniqueness has been slaughtered. Otherwise, I can imagine some major
> pain being caused because of this... I found uniqueness hard enough to
> grasp initially as it is :)
> 

I don't see this as being any different to passing a variable with
unique inst to a predicate that requires an initial inst of ground.
If either of the variables being passed to p/2 is required to be
unique later in the goal then you will get a mode error at that point.

If the user wants a unique mode for p/2 they could do something like

	:- mode p(di(I), out(I)) <= I is unique.

which my changes to the mode checker will handle, once the syntax is
implemented.  In mode-checking this mode of p/2, the mode checker will
treat inst I as though it is unique.

-- 
David Overton       Department of Computer Science & Software Engineering
PhD Student         The University of Melbourne, Australia
+61 3 9344 9159     http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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