[m-dev.] for review: RTTI & split c files
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Mar 14 16:00:31 AEDT 2000
On 14-Mar-2000, Zoltan Somogyi <zs at ender.cs.mu.oz.au> wrote:
>
> Estimated hours taken: 3
>
> Make the RTTI system operate with --split-c-files.
>
> compiler/rtti_out.m:
> Generate declarations of the other entities referenced by an RTTI
> structure before the definition of that structure is output.
>
> compiler/llds_out.m:
> Add a new output predicate for use by rtti_out.m
That looks fine.
> library/std_util.m:
> Add a new utility predicate for use by rtti_out.m.
...
> +:- pred if_yes(maybe(T)::in, T::out) is semidet.
...
> +if_yes(yes(Value), Value).
Is this really of sufficient utility to be worth including in the standard
library? It might be better to just define this in the compiler sources for
now and then move it to the library if/when we find that it is used often.
Using this predicate directly doesn't really buy you much,
because simply writing
X = yes(Y)
is clearer than
is_yes(X, Y).
So the only time that it would make sense to use this predicate would
be as a higher-order argument, e.g. to something like list__filter_map.
Even then, it doesn't buy you a _lot_, since it's pretty easy to define
inline, either as `(pred(yes(X)::in, X::out) is semidet)',
or as `(func(yes(X)) = X is semidet)'.
If it was a semidet function rather than a predicate, then it would
make sense to use it directly, and so the argument for its inclusion
would be much stronger.
If you really do want to add it to the standard library, then it should
at least be documented, and the change should be mentioned in the NEWS file.
But I would suggest handling that as a separate change.
--
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