[m-rev.] for review: Add java support for the function foreign__to_type_string/2
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Mar 12 06:35:36 AEDT 2002
On 11-Mar-2002, Andre Yang <ayang at rationalizer.com> wrote:
> foreign.m:
> Adds the support for java in the function to_type_string/2.
...
> +to_type_string(java, mercury(Type)) = Result :-
> + ( Type = term__functor(term__atom("int"), [], _) ->
> + Result = "int"
> + ; Type = term__functor(term__atom("float"), [], _) ->
> + Result = "double"
> + ; Type = term__functor(term__atom("string"), [], _) ->
> + Result = "String"
> + ; Type = term__functor(term__atom("character"), [], _) ->
> + Result = "char"
> + ;
> + Result = "Object"
> + ).
That looks like it is not correct.
1. For consistency with mlds_to_java.m, all Java names that we generate
should be fully-qualified, so it should be "java.lang.String"
and "java.lang.Object" rather than "String" and "Object".
2. I think special handling may be needed here for other types,
similar to that in mercury_output_type in mlds_to_java.m.
In fact, to verify the correctness, I'd like to see the documentation,
but there's no documentation. At very least you should add an XXX
comment saying that this code might not be correct.
Even better would be to add the appropriate "Language-specific binding"
section for Java in the Mercury language reference manual; then we could
verify whether this code does what the reference manual says it should do.
--
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