[m-dev.] for review: prelim support for hash consing
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Aug 27 01:53:58 AEST 1999
On 26-Aug-1999, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> On 25-Aug-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> >
> > I think the format of the error message is irrelevant, because the pragma
> > should be such that there is no ambiguity. The design I discussed with Fergus,
> > which his original mail mentioned, had two kinds of pragmas:
> >
> > :- pragma hash_cons(typector/arity)
> > :- pragma hash_cons(typector/arity, [ctor1/arity1, ctor2/arity2, ...])
>
> This isn't what Pete has implemented. The pragma he has implemented is:
>
> :- pragma memo_cons(ctor/arity).
>
> ie. it specifies a constructor, not a type ctor. Should that be fixed?
Yes, Peter should fix his code.
> > >> The mangled name could maybe be a little more robust... I'm not sure what,
> > >> though.
> >
> > I thought we decided that the best approach would be to reserve a character
> > ('_', or '$' or ...) so that only compiler-created predicates can start
> > with that character. User-created predicates whose names start with that
> > character (names which must be quoted) would then have another character
> > inserted at the front by the compiler. Implementing this system would seem
> > to me to be a job best done by Fergus, or possibly Simon.
For now, I suggest we just make sure that all names used by the implementation
start with "__", which is what we use at the moment. We also use '$',
but only in diagnostics (e.g. error messages or HLDS dumps that contain
compiler-defined insts or pragma c_code HLDS goals), not for definitions.
Mangling user names that happen to start with "__" is probably easy enough,
but then we'd also need to make sure that we unmangle them at all the
appropriate places, and doing that would require a fair bit of work,
so I suggest we leave it for the moment. Instead, we could just mention
somewhere (e.g. in the LIMITATIONS file, or perhaps just the bugs list)
that we don't yet support user names starting with "__".
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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