This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Kava for GCJ?
- From: Per Bothner <per at bothner dot com>
- To: Adam Megacz <gcj at lists dot megacz dot com>
- Cc: java at gcc dot gnu dot org
- Date: Wed, 02 Jul 2003 22:50:16 -0700
- Subject: Re: Kava for GCJ?
- References: <m1vfuk5shk.fsf@nowhere.com>
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/