[m-rev.] diff: foreign export bool for java
Julien Fischer
juliensf at csse.unimelb.edu.au
Tue Aug 11 22:18:38 AEST 2009
Hi Peter,
On Tue, 11 Aug 2009, Peter Wang wrote:
> On 2009-08-11, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>
>> On Tue, 11 Aug 2009, Peter Wang wrote:
>>
>>> Branches: main
>>>
>>> library/bool.m:
>>> Export `bool' enumeration values for Java foreign code.
>>>
>>> diff --git a/library/bool.m b/library/bool.m
>>> index a620e98..f997bfb 100644
>>> --- a/library/bool.m
>>> +++ b/library/bool.m
>>> @@ -77,6 +77,12 @@
>>> % The representation of bool values should correspond with the definitions of
>>> % MR_TRUE and MR_FALSE in runtime/mercury_std.h.
>>>
>>> +:- pragma foreign_export_enum("Java", bool/0, [],
>>> + [
>>> + no - "ML_NO",
>>> + yes - "ML_YES"
>>> + ]).
>>> +
>>
>> For consistency with the C version perhaps they should be called MR_NO
>> and MR_YES? (Or at least add a second foreign_export_enum pragma that
>> uses those names.)
>
> I've changed it in this patch (and builtin.comparison_result) but I'm
> not really sure about it.
My main concern was that in modules that have both C and Java foreign
code (e.g. many of the standard library modules), the slight difference
between the two would be a source of errors.
Looking at it some more though, I think we should dispense with both the
ML_ and MR_ prefixes in Java. The sort of namespace problems they are intended
to address can't arise in Java anyway.
>> You should also update the Java data passing conventions section of the
>> reference manual. (You may as well add the foreign export for
>> builtin.comparison_result that the C grades have as well).
>
> For review:
>
> Branches: main
>
> library/bool.m:
> library/builtin.m:
> Rename exported enumeration values for Java to MR_* for consistency with
> the C version.
>
> library/list.m:
> Add `MR_empty_list', `MR_cons', `MR_is_empty', `MR_det_head' and
> `MR_det_tail' for manipulating lists from Java foreign code.
Likewise with the MR_ prefix here.
>
> Add wrapper class `MR_ListIterator<E>' that allows iteration over
> Mercury lists using Java for-each syntax (undocumented for now).
>
> doc/reference_manual.texi:
> doc/user_guide.texi:
> Update documentation pertaining to Java foreign language interface.
>
> library/bitmap.m:
> library/rtti_implementation.m:
> library/string.m:
> Conform to renamings.
>
> Use for-each syntax in some places.
The diff looks fine - a further improvement would be to document
pragma foreign_{export_enum,enum} for the Java backend.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list