[m-dev.] Re: Documentation of support for polymorphic pragma c code
Peter Schachte
pets at students.cs.mu.oz.au
Wed Jan 14 18:11:38 AEDT 1998
On Wed, 14 Jan 1998, Fergus Henderson wrote:
> > :- pred fug(T1, T2).
> > :- mode fug(in, out) is det.
> >
> > :- pragma c_code(fug(A::in, B::in) ,"
> > do_some_stuff(MR_TYPE_INFO(T1,1), MR_TYPE_INFO(T2,1), A, B);
> > ").
>
> That could be implemented very easily:
>
> #define paste(x,y) x##y
> #define MR_TYPE_INFO(var) paste(TypeInfo_for_,var)
Cute....
> Using a macro like this puts a small layer of abstraction over
> the arguably ugly technique of using special variable names.
> On the other hand, I'm not sure it really adds much.
I just find it syntactically a bit cleaner.
> One potential drawback with this is that MR_TYPE_INFO() could only
> be used within the `pragma c_code'
True.
> > (The second argument to MR_TYPE_INFO being the parameter number of the type
> > of the first argument, needed for multiparametric types).
>
> I don't understand why this is needed.
Nevermind. I was just confused.
-Peter Schachte | The wrong sort of people are always in power
pets at cs.mu.OZ.AU | because they would not be in power if they
http://www.cs.mu.oz.au/~pets/ | were not the wrong sort of people. -- Jon
PGP key available on request | Wynne-Tyson
More information about the developers
mailing list