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

David Glen JEFFERY dgj at cs.mu.OZ.AU
Wed Aug 5 15:22:58 AEST 1998


On 05-Aug-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> 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.
> 

Yuck! Should that actually be legal?


love and cuddles,
dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
PhD student,                    |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list