[m-rev.] for review: rename internal field for enum classes (java)
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri May 22 22:02:35 AEST 2009
On Fri, 22 May 2009, Peter Wang wrote:
> Are there grades I should check? Grepping for "value" doesn't help.
No, the Java backend is only MLDS backend that treats enums this way.
In retrospect, I think boxing them like this was a bad idea -- the
original rationale was that it would make
:- pragma foreign_proc("Java, ... and friends more type safe. As it is,
it probably makes things less efficient and definitely makes
mlds_to_java.m more complicated.
Since recent versions of Java have enums it would be better to just use
them.
> Branches: main
>
> In the Java grade, an enumeration is represented by a class with a `value'
> field, alongside constants named by the user. A constant named `value'
> would conflict with that field, so we rename it to `MR_value'.
>
> compiler/ml_type_gen.m:
> compiler/mlds_to_java.m:
> As above.
>
> tests/hard_coded/Mmakefile:
> tests/hard_coded/value_enum.exp:
> tests/hard_coded/value_enum.m:
> Add test case.
The diff appears fine.
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