This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Kava for GCJ?


Hi People,

>Maybe this is a dumb question, but could you explain to me how
>Adam's code has the same visible effect for reference and value
>classes with your additional restrictions? Taking Adam's example
>one step further:
>
>    a.setState(Thing.HAPPY);
>    b.setState(Thing.SAD);

Oops, I missed this part:

Kees> >- All fields must be 'final'

...which would appear to make the setter calls illegal
(unless I've misunderstood something).

Given this, I'm not understanding the usefulness of
such value classes at all, given that an immutable
Java class accomplishes the same thing, albeit more
efficiently.

The restriction on fields being final definitely does
not hold for value classes (structs) in C#, for example.

Thanks for bearing with these questions.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]