Re: Java 7 vs 8 speed issues on Win7?
On 11/6/2014 9:09 AM, Jan Burse wrote:
Hi,
Eric Sosman schrieb:
I, too, wonder what he meant by "changed semantics," since as far
as I know the contract of String#substring(int,int) has not changed
since Java 1.0, and perhaps earlier. The underlying implementations
have changed, I believe, but that's not what I'd call a "semantic"
difference.
I don't think a method signature (=contract) alone
defines any semantics.[...]
I guess we'll just have to accept that "semantics" means something
different to you than it does to me. It seems you consider the quirks
of a particular implementation are part of the "semantics," while I do
not. Merriam-Webster offers two capsule definitions:
the study of the meanings of words and phrases in language
the meanings of words and phrases in a particular context
.... plus more detailed definitions using words like "semiotics"
and "signification." The use of "semantics" in re programming is
clearly something of an abuse or at least a twist of the actual
meaning, so I doubt there's a usable authority to whom we can
appeal to resolve our different understandings of the word. We'll
just have to accept that we differ -- and that You're Wrong!!! :)
That the semantic has changed can also be seen by the
fields that the String class now features (JDK 8):
private final char value[];
private int hash;
Note the keyword `private'. Thought experiment: If `hash'
were declared before `value' instead of after, would that be a
"semantic" change? What if the fields were renamed to `data'
and `code'; would that be a "semantic" change?
So the internal contract has massively changed.
If there's any such thing as an "internal contract," this is
the first I've heard of it. The entire premise of "write to the
interface, not the implementation" is that such contracts do *not*
exist! As a practical matter they sometimes sort of do: We expect
an Iterator's implementation of next() to take approximately constant
time, or maybe logarithmic at the worst, although there's nothing
in any contract anywhere that actually makes such a promise. I'm
not denying that the supposedly-invisible internals sometimes make
themselves apparent and present problems or opportunities; I'm just
resisting the attempt to refer to such things as part of a "contract"
or to call them "semantics."
Thought experiment: If the next JVM patch improves the JIT so
sparse `switch' blocks on `char' values are compiled more efficiently,
is that a change in the "semantics" of `switch'?
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM