[m-dev.] for review: rewrite of check_typeclass.m
David Glen JEFFERY
dgj at cs.mu.OZ.AU
Thu May 21 01:04:00 AEST 1998
On 21-May-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 20-May-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
>
> > +:- pred check_instance_pred_procs(list(var), sym_name,
> > + hlds_instance_defn, hlds_instance_defn,
> > + instance_method_info, instance_method_info).
> > +:- mode check_instance_pred_procs(in, in, in, out, in, out) is det.
> > +
> > +check_instance_pred_procs(ClassVars, MethodName, InstanceDefn0, InstanceDefn,
> I don't understand why you still need this predicate,
> and many others in this module. Is that just to support the optimization
>
> > + % As an optimisation, if the types and constraints
> > + % are _exactly_ the same, there is no point introducing
> > + % a predicate to call the instance method
>
> ? I think you could simplify the code dramatically
> if you delete this optimization -- is that correct?
That is quite correct.
> I think the right time to do this optimization is after LLDS optimization.
> Doing it here seems to add a lot of complexity for relatively little benefit.
> This will have significant maintenance costs.
I agree.
>
> I suggest you check it in with the optimization in place,
> and then delete the optimization as a separate change.
> (That way, if we ever want to add it back, it'll be easy.)
Yes, that's a good idea.
> > + % Perhaps we should include the pred arity in this mangled
> > + % string?
> > + % string__int_to_string(PredArity, PredArityString),
> > + base_typeclass_info__make_instance_string(InstanceTypes,
> > + InstanceString),
>
> The pred name had better be unique, otherwise you may get
> link errors or C compiler errors. Thus yes, you should include the pred
> arity.
But the arity gets included in the C name by llds_out. Am I right?
Is it OK to commit once I've changed these, or would you like to see another
diff?
love and cuddles,
dgj
--
David Jeffery (dgj at cs.mu.oz.au) | Marge: Did you just call everyone "chicken"?
MEngSc 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