From: Öö Tiib on
On 20 juuli, 20:28, Lew <l...(a)lewscanon.com> wrote:
> Öö Tiib wrote:
> > Why you cross posted to several groups? Post into every group
> > individually if you need different opinions. There are lot more
>
> Wrong.  You describe multi-posting, one of the cardinal sins of
> Usenet.  Cross-posting is much better.
>
> Do not multi-post.  Ever.
>
> Cross-post only when you must, to the least number of relevant groups.

OK. Thanks for correcting. I do neither anyway unless replying.
comp.lang.c++ and comp.lang.c++.moderated keep me usually entertained
enough.

> > languages. Each is different. For example java [sic] does not have language
> > elements dedicated for const correctness at all i [sic] think. However ....
>
> Wrong again, sort of.  Java has 'final' which is sort of similar to
> 'const'.

I have not seen much usage of it nor heard much talk about 'final-
correctness' in friendly java teams. C devs talk about const a lot
more. Perhaps that 'final' sort of misses some useful perks of
'const'.
From: Jonathan Lee on
On Jul 20, 2:04 pm, Öö Tiib <oot...(a)hot.ee> wrote:
> On 20 juuli, 20:28, Lew <l...(a)lewscanon.com> wrote:
> > Wrong again, sort of.  Java has 'final' which is sort of similar to
> > 'const'.
>
> I have not seen much usage of it nor heard much talk about 'final-
> correctness' in friendly java teams. C devs talk about const a lot
> more. Perhaps that 'final' sort of misses some useful perks of
> 'const'.

I've never heard of an equivalent of "const correctness" in Java,
but I also don't use it very much. Though, a quick Google search
seems to support the idea that "final" is really nothing like
const-correctness:

http://en.wikipedia.org/wiki/Final_%28Java%29
http://stackoverflow.com/questions/1370042/why-is-const-correctness-specific-to-c
http://mannu.livejournal.com/131085.html
http://en.wikipedia.org/wiki/Const-correctness

--Jonathan
From: Pete Becker on
On 2010-07-20 14:04:15 -0400, �� Tiib said:

> On 20 juuli, 20:28, Lew <l...(a)lewscanon.com> wrote:
>> �� Tiib wrote:
>>> Why you cross posted to several groups? Post into every group
>>> individually if you need different opinions. There are lot more
>>
>> Wrong. �You describe multi-posting, one of the cardinal sins of
>> Usenet. �Cross-posting is much better.
>>
>> Do not multi-post. �Ever.
>>
>> Cross-post only when you must, to the least number of relevant groups.
>
> OK. Thanks for correcting. I do neither anyway unless replying.
> comp.lang.c++ and comp.lang.c++.moderated keep me usually entertained
> enough.
>
>>> languages. Each is different. For example java [sic] does not have language
>>> elements dedicated for const correctness at all i [sic] think. However...
>>
>> Wrong again, sort of. �Java has 'final' which is sort of similar to
>> 'const'.
>
> I have not seen much usage of it nor heard much talk about 'final-
> correctness' in friendly java teams. C devs talk about const a lot
> more. Perhaps that 'final' sort of misses some useful perks of
> 'const'.

Yup. Most of them, in fact.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

From: Alan Gutierrez on
Jonathan Lee wrote:
> On Jul 20, 2:04 pm, �� Tiib <oot...(a)hot.ee> wrote:
>> On 20 juuli, 20:28, Lew <l...(a)lewscanon.com> wrote:
>>> Wrong again, sort of. Java has 'final' which is sort of similar to
>>> 'const'.
>> I have not seen much usage of it nor heard much talk about 'final-
>> correctness' in friendly java teams. C devs talk about const a lot
>> more. Perhaps that 'final' sort of misses some useful perks of
>> 'const'.
>
> I've never heard of an equivalent of "const correctness" in Java,
> but I also don't use it very much. Though, a quick Google search
> seems to support the idea that "final" is really nothing like
> const-correctness:

The equivalent in Java to "const-Correctness", culturally, is "Favor
Immutability". The same sort of conversation taking place here is one
that follows a request to explain the benefits of "Favor Immutability".

I'm new here, and I humbly submit the above observation.

--
Alan Gutierrez - alan(a)blogometer.com - http://twitter.com/bigeasy
From: Lew on
Lew wrote:
>>>> Wrong again, sort of. Java has 'final' which is sort of similar to
>>>> 'const'.

Öö Tiib wrote:
>>> I have not seen much usage of it nor heard much talk about 'final-
>>> correctness' in friendly java [sic] teams. C devs talk about const a lot

That's because that's not what we call it. Alan gives you the correct term.

>>> more. Perhaps that 'final' sort of misses some useful perks of
>>> 'const'.

Or perhaps Java's 'final' doesn't need those "perks" because of the other
differences between the languages.

Jonathan Lee wrote:
>> I've never heard of an equivalent of "const correctness" in Java,

Therefore it doesn't exist? Anyway, the claim isn't that there's an exact
equivalent to "const correctness" but that Java's 'final' has similarities to
C++'s 'const', and relative to the Java language fills the same ecological niche.

>> but I also don't use it very much. Though, a quick Google search
>> seems to support the idea that "final" is really nothing like
>> const-correctness:

Again, that's not the claim. The claim is that 'final' is similar for Java to
what 'const' is in C++, in certain ways.

Alan Gutierrez wrote:
> The equivalent in Java to "const-Correctness", culturally, is "Favor
> Immutability". The same sort of conversation taking place here is one
> that follows a request to explain the benefits of "Favor Immutability".
>
> I'm new here, and I humbly submit the above observation.

Everyone here seems to think that Java 'final' is just nothing a-'tall like
C[++] 'const'. They are, of course, mistaken.

Both keywords signal to the compiler that the item so marked cannot be altered.

Since Java supports only pointers and primitives and not value-object
variables, the semantics of its 'final' are bound to differ from those of
C++'s 'const'. C++ and Java are different languages. But in terms of
enforcing "least privilege" (this conversation's avowed topic) and
immutability, the two constructs serve cognate purposes.

--
Lew