Kava for GCJ?

Per Bothner per@bothner.com
Thu Jul 3 05:48:00 GMT 2003


Adam Megacz wrote:
> Has anybody heard of a Kava implementation for GCJ?
>> http://citeseer.nj.nec.com/bacon02kava.html
>> Kava basically brings C# structs (unboxed complex types) to Java, but
> does a much better job. You can even define unboxed scalars that are
> constrained to be less than the length of a given array, thereby
> safely elimnating bounds checks.
>> Hrm, I wonder if this would be hard to implement... might be worth my
> time.

The problem is that this changes Java in incompatible ways. I prefer
a solution where you *annotate* a class that can only be uses in
certain ways, and an implementation is *encouraged* to use unboxed
types, but not required to:
public final class Point
{
 // The magic annotation:
 static final boolean gnu$gcj$VALUE_CLASS = true;
 // Fields are final.
 public final float x, y;
 // No public constructors:
 private Point(float x, float y) { this.x = x; this.y = y; }
 public static Point make (float x, float y)
 { Point p = new Point(x, y);
 // Conceptually: p = intern(p);
 return p;
 }
 ...
}
I wrote up a more detailed proposal, but it needs some editing,
and I'm leaving on vacation tomorrow morning. Perhaps you could
remind me to post it if I haven't done so by Thursday next week?
If we come up with and implement a design, we should perhaps
propose it as a JSR. (I've suggested something similar to some
Sun people last year, and they agree with the concept.)
-- 
	--Per Bothner
per@bothner.com http://per.bothner.com/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /