[m-dev.] diff: fix bug with simplify.m & existential types

Tyson Dowd trd at cs.mu.OZ.AU
Wed Aug 5 14:17:06 AEST 1998


On 05-Aug-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> On 04-Aug-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > compiler/simplify.m:
> > 	Fix a bug: it was incorrectly optimizing away calls to
> > 	existentially typed predicates if the call had no output
> > 	variables.  In such cases, it should not optimize the call
> > 	away, since the type_info is output.
> > 
> > 	For the moment I have just disabled the optimization.
> > 	The proper fix would be to run polymorphism.m before simplify.m
> > 	rather than vice versa.  When we've done that, we can re-enable
> > 	this optimization.
> 
> Could you supply a test case, please? I'm struggling to imagine what such a
> test case would look like.

At a guess, I would say:

	% The predicate has_type/2 is basically an existentially typed
	% inverse to the function type_of/1.  It constrains the type
	% of the first argument to be the type represented by the
	% second argument.
	%
	% Warning: support for existential types is still experimental.
	%
:- some [T] pred has_type(T::unused, type_info::in) is det.

-- 
       Tyson Dowd           # There isn't any reason why Linux can't be
                            # implemented as an enterprise computing solution.
     trd at cs.mu.oz.au        # Find out what you've been missing while you've
http://www.cs.mu.oz.au/~trd # been rebooting Windows NT. -- InfoWorld, 1998.



More information about the developers mailing list