This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: HPC Java
Terry Sikes wrote:
Per Bothner wrote:
> About two years ago I wrote up idea for "immediate classes".
> These would be final classes with final fields, so they could
> be treated as value types.
>
This sounds ideal. What are the obstacles to implementing this as a gcj
extension?
Time, money, poltics ...
First there has to be a design that people agree on, and then it has
to be implemented. Ideally this should be down in the context of a
JSR, which may slow things down but would help with adoption.
As mentioned, Titanium's immutable classes are a similar idea, but
instead of using a special keyword:
immutable class C { ... }
we use a special interface:
class C extends javax.value.Immutable { ... }
(Or maybe we could use annotations.)
A compiler with support can check the constraints, and then
generate "struct"-style code. The goal is the applications that use
Immutable should work (with reduced efficiency) even if "magic".
There are various design issues: E.g. should you be able to
extend an Immutable class? Should we allow mutable "struct"
classes (as in C#) as well? For immutable values we'd like
== to map to value to equality - how do we do that? How do
we change the ABI?
--
--Per Bothner
per@bothner.com http://per.bothner.com/