[mercury-users] Circular lists

Warwick HARVEY warwick at cs.mu.oz.au
Fri Dec 5 14:12:31 AEDT 1997


Fergus Henderson <fjh at cs.mu.OZ.AU> writes:
> Warwick HARVEY <warwick at cs.mu.oz.au> wrote:
> > What I'm currently trying to implement involves
> > (essentially) a store of stores.  If each store is forced to have a
> > different type, there is no way I can form a collection of them.
>
> Currently that is true, but when we have support for existential types,
> you will be able to use them to create heterogenous collections.
> So, existential types might introduce a problem, but they also
> provide a solution to that problem.

Fair enough.  I look forward to learning more about these beasts --- but not
right now.  :-)

(Thesis?  What's a thesis?)

> If a predicate takes a store as an input argument,
> then you should use a (universal) polymorphic type, i.e. `S'.
> If a predicate creates a store using store__init/1 and returns it
> as an ouput argument, then ideally you should use an existential polymorphic
> type; but in the absence of existential types, you should probably
> use `some_store_type'.
>
> In other words, to minimize future problems, you should replace *some*
> of the occurrences of `S' with `some_store_type' -- as few as possible.

This was what I tried to do initially.  Unfortunately there was a flow-on
effect to other predicates (through a layer or two of abstraction, and then
recursion amongst the higher-level predicates).  At that point I decided it
would probably be easier to just change them all and change them all back
later, than to determine exactly which ones needed to be changed and which
ones didn't (I expected the latter set to be small).

				Warwick

----------------------------------------------------------------------------
Warwick Harvey                                    email: warwick at cs.mu.OZ.AU
Department of Computer Science                        phone: +61-3-9344-9171
University of Melbourne                                 fax: +61-3-9348-1184
Parkville, Victoria, AUSTRALIA 3052     web: http://www.cs.mu.OZ.AU/~warwick



More information about the users mailing list