[m-dev.] cvs diff: Bug fix for layoutst
Tyson Richard DOWD
trd at students.cs.mu.oz.au
Thu Mar 20 09:47:59 AEDT 1997
>
> Tyson Richard DOWD, you wrote:
> >
> > However, when I finish the code for `type_of' ...
>
> What does `type_of' do?
>
> I have been using the name `type_of' for the following function:
>
> :- type (type).
> % `type' is another name for `type_info(T)'.
> % ... some low-level magic to implement unification (etc.)
> % of values of type `type' omitted ...
>
> % type_of(X) = T iff T is the type of X.
> :- func type_of(T::unused) = ((type)::out) is det.
> :- pragma c_code(type_of(_X::unused) = (Type::out),
> will_not_call_mercury, "Type = TypeInfo_for_T;").
Then you've changed your names slightly from when you asked for this to
be implemented - you used type_info, not type. Otherwise it is much
the same.
:- type type_info == c_pointer.
:- func type_of(T) = type_info.
:- mode type_of(unused) = out is det.
The c_code basically does what you ask, but will also need to check for
`univ' and give an error or something, (you can't do anything with a
univ without some data), and you should also look past any
equivalences at this point, for efficiency.
--
Tyson Dowd # "Well, let's just say, 'if your VCR is
# still blinking 12:00, you don't
trd at cs.mu.oz.au # want Linux'".
http://www.cs.mu.oz.au/~trd # --Bruce Perens, Debian's Fearless Leader
More information about the developers
mailing list