You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is the semantic of the keyword "const" coming from the "const" in C++, "const" or "immutable" in D, "const" or "readonly" in C#, or "final" in Java?
The code from the "counting" demo indicates that the semantic of "const" is the same as the semantic of "final" in Java:
const AtomicInteger count = new AtomicInteger
...
count.incrementAndGet
It may be confusing for developers because "const" means "read only" for most of them.
Moreover, it seems correct to write with the current semantic:
const BigInteger abc = new BigInteger(4)
abc.add(6)
I think it is in contradiction with the use of "const" in the other programming languages. The following "equivalent" code is not working with these languages:
const int abc = 4;
abc = abc + 4;
The text was updated successfully, but these errors were encountered:
Is the semantic of the keyword "const" coming from the "const" in C++, "const" or "immutable" in D, "const" or "readonly" in C#, or "final" in Java?
The code from the "counting" demo indicates that the semantic of "const" is the same as the semantic of "final" in Java:
It may be confusing for developers because "const" means "read only" for most of them.
Moreover, it seems correct to write with the current semantic:
I think it is in contradiction with the use of "const" in the other programming languages. The following "equivalent" code is not working with these languages:
The text was updated successfully, but these errors were encountered: