[m-rev.] For review: Java implementation of std_util library

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Jan 19 17:39:03 AEDT 2004


On 19-Jan-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> James Goddard, Monday, 19 January 2004:
> > Estimated hours taken: 5
> > Branches: main
> > 
> > Implement some library procedures for the Java back end.
> > 
> > library/std_util.m:
> > 	Defined the type mutvar(T) as an array of java.lang.Objects (which
> > 	will always be size 1)
> 
> I'm baffled: why a unit array and not just an ordinary java.lang.Object?

An ordinary java.lang.Object wouldn't work, because an extra level of
indirection is required.  There would be no way to implement
store__set_mutvar, because some classes (e.g. java.lang.String, IIRC)
are immutable and cannot be modified once they are constructed.

An alternative that would work would be to use an object of a particular
class that happens to have one field of type java.lang.Object.
That might be slightly more efficient than using an array,
because it would avoid any need for array index bounds checks.
But it's not a big deal.

-- 
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