[m-dev.] construct/deconstruct (was Re: [m-rev.] for review: calling Mercury from Aditi)
Simon Taylor
stayl at cs.mu.OZ.AU
Mon Oct 25 22:42:35 AEST 2004
On 25-Oct-2004, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 20-Oct-2004, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > By the way, what was the rationale for
> > numbering constructors passed to `construct.construct' using
> > lexicographic order (which has no semantic meaning in Mercury)
> > rather than declaration order, which affects comparison order.
>
> There was no good rationale.
>
> > There is no simple way to get the lexicographic order index of a
> > constructor given the declaration order index, but we do provide
> > construct.get_functor_ordinal, which produces the declaration order
> > index of a constructor given the lexicographic order index.
>
> The whole set of predicates in construct and deconstruct should be overhauled
> after a thorough review of requirements, but it hasn't been a high priority.
The proper way to do it would be to have `functor' and `deconstruct'
return a discriminated union description of the functor (instead of
returning a string as it does now), and provide functions to create
a functor description from the name and arity, declaration order index
or lexicographic order index.
Unfortunately the existing code would be extremely difficult to
modify to do this, because `functor' is implemented in macro-heavy
C code in the runtime.
Has anyone done any timings to see how much faster the C version
of deconstruct is than the version in library/rtti_implementation.m?
Simon.
--------------------------------------------------------------------------
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