[m-rev.] for review: minor changes for valuetype foreign_types

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 22 20:18:20 AEDT 2002


On 22-Jan-2002, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 21-Jan-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > On 20-Jan-2002, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > > A few minor fixes promped by petdr's addition of support for value types
> > > for foreign_type.
> > ...
> > > doc/reference_manual.texi:
> > > 	Improve the documentation wording for pragma foreign_type, and
> > > 	remove the XXX saying that we should accept value types, because
> > > 	we now accept value types.
> > 
> > It's not right to remove that XXX, since you've only fixed part of the
> > problem -- after petdr's change, user-defined value types are supported,
> > but builtin value types such as `int32' still aren't.
> 
> They are.
> 
> :- pragma foreign_type(il, int32, "valuetype [mscorlib]System.Int32").

Won't that violate the MSIL prohibition on using the value type name
for the builtin types?

Oh, now I understand -- we parse the IL type name,
and then convert the value type names for builtin types
into the appropriate special name.  The documentation change
you posted is a big improvement.

It would be nice if we could also accept the special name syntax...
perhaps that should be left as an XXX.

> +++ doc/reference_manual.texi	22 Jan 2002 02:29:01 -0000
> @@ -5472,17 +5472,25 @@
>  Note that extra whitespace is not handled --- there should only be a single
>  space between the class keyword and the assembly specifier.
>  @c XXX we should handle whitespace better
> +Value types which have a special name (such as @samp{int32}) can be
> +named using their valuetype syntax, they will be marshalled using their
> +special name (as is required by section 7.2 of Partition II of the ECMA
> +CLI documentation).

s/,/;/

>  For example:
>  
>  @example
>  :- type xmldoc.
>  :- pragma foreign_type(il, xmldoc, "class [System.Xml]System.Xml.XmlDocument").
> +:- type int32.
> +:- pragma foreign_type(il, int32, "valuetype [mscorlib]System.Int32").
>  @end example
>  
>  ensures that on the .NET CLR backend the Mercury type @samp{xmldoc} is
>  marshalled by the backend as @samp{System.Xml.XmlDocument} from assembly
> - at samp{System.Xml}.
> + at samp{System.Xml}, and that the Mercury type @samp{int32} will be
> +marshalled by the backend as @samp{int32}.

I suggest
s/@samp{int32}/the CLR type @samp{int32}/

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list