On Mon, 27 Aug 2018 16:42:52 -0000 (UTC)
Juha Nieminen <nos...@thanks.invalid> wrote:
> Chris Vine <chris@cvine--nospam--.
freeserve.co.uk> wrote:
> > Mistakes happen and this one is not the end of the world (unless you
> > are actually writing multi-threaded code for clients "without a locking
> > mechanism" for const methods operating on objects mutable by other
> > threads). Move on. And when you are in a hole, stop digging.
>
> So even after I clearly explain what I meant, you still choose to act
> like an a-hole.
>
> I explained in this thread, again and again, multiple times, that what
> I mean is that "a const method should be implemented so that it can be
> safely called from multiple threads without the need of a locking
> mechanism". It's not even my idea.
I would not agree with that point either. Const methods should, in my
opinion, be implemented so that they can safely be called from multiple
threads without the need for a locking mechanism provided that the
object concerned cannot also be concurrently mutated by a non-const
method. If it can be concurrently mutated the user needs an external
locking mechanism. It also happens to the be approach adopted by most
code I have seen, including the standard library.
> Now you cling onto that term "thread-safe", apply your particular
> meaning to it, rather than asking me what I meant, and declare yourself
> victorious, and proceed to mock me.
>
> You also conjured the C++ standard library from somewhere, even though
> nowhere did I mention anything about it, and then you just ignore that.
> Hilariously, you proceeded to explain that the C++ standard library
> behaves *EXACTLY* like I described const member functions to be
> supposed to behave. Yet, still, I am the one who is somehow in the wrong
> here. Because of that one term "thread-safe" in one post, which you still
> keep clinging onto.
I am not trying to mock you. I was trying to point out, apparently
unsuccessfully, that if you think that invoking a const method is going
to be thread-safe by virtue of it being const, you will be writing
thread-unsafe code. I think you are so self-defensive that you have
become confused.
As to the meaning of "thread-safe", (i) it is well established in the
industry, and (ii) words cannot just mean whatever you want them to
mean.
Humpty Dumpty: "... There's glory for you!"
"I don’t know what you mean by 'glory'," Alice said.
Humpty Dumpty smiled contemptuously. "Of course you don't – till I
tell you. I meant 'there's a nice knock-down argument for you!'"
"But 'glory' doesn't mean 'a nice knock-down argument'," Alice
objected.
"When I use a word," Humpty Dumpty said, in a rather scornful tone,
"it means just what I choose it to mean – neither more nor less."
"The question is," said Alice, "whether you can make words mean so
many different things."
"The question is," said Humpty Dumpty, "which is to be master - that's
all."
I am with Alice, not Humpty Dumpty.