B
Balog Pal
Alf P. Steinbach said:The incompetence of experienced people is a problem with no known
solution.
You say that at least some people, and I assume that you mean experienced
ones, expect the language to behave in a nonsensical way, like some other
language they're familiar with.
I don't say that. The observation is that people just drop in the
virtual call. And start to thinker on the language behavior after getting
burnt.
And not necessarily "expect" the thing work this or that way. The pragmatic
way is to do the work anyway instead of dreaming about a different world.
Guidelines just help to minimize the wasted time. Not going there in the
first place or having the relevant info faster at least.
And it seems that you're implicitly arguing that because of their
nonsensical expectation the safe behavior is a problem.
That since they practically can't be made competent, the language should
be dumbed down to their level, removing safety features they fail to
understand.
That's shadow-boxing. ;-)
I don't have a problem of how C++ deals with virtuals, and most likely would
chose the same behavior. And I also agree with the guideline that states
don't call virtuals in the situation.
Those who are competent and found the rare situation it makes sense or is is
just safely irrelevant will hardly be bothered by it.
No, the FAQ is mainly for novices.
A novice may expect C++ to work like some other language, e.g. like Java.
An experienced C++ programmer who expects that, however, is incompetent.
Sure. This has nothing to do with the point I made.
I am competent in programming and C++. I do know the behavior of virtuals.
Including this thing. I know it for ages, and at the pioneering period
worked even with the assy code of ctors/dtors. To know the exact point where
the VMT pointer is replaced (effectively changing the actial type of the
object at hand).
Yet, I recall at least one situation from my work I got hit by the related
problem -- having the wrong (meaning not the *intended*) function called
form a base destructor. Wasn't a big deal, and realized it in the first run
(probably it was a pure virtual with a noisy report).
But well demonstrates that shit just happens. ;-))
I have on some occasions dumbed down code so that it "should" be grokkable
even by idiots.
We know that is a futile effort, as nature immediately creates an advanced
idiot. And starts cloning it too.
You don't want to rearrange the correctly working C++ code.
So, C++: zero time.
Computers do what is ordered, not what was intended. The "correct" code
would be with the intended behavior. The fact that the C++ part safely does
the unintended thing will not make it fly.
This doesn't make sense. It seems you have some problem and some
particular based-on-misconceptions non-working solution to that problem in
mind. Don't blame that on the language: blame it on a fixation on a
non-working solution.
You can put it that way if you like, it won't make the problem go away.
The mind works in an interesting way. See the examples of the optical
illusions. (or how is that called when you see straight lines as curved,
equal length as different, same color as massively darker in a properly
created picture).
Similar fallacy is to expect things to "work". There was recently a
reference to Mark Rosewater's evil creations here or on a neighboring forum.
And that is exactly true.
And the more commonly a feature just does the job the less we think there
are limits.
What you're saying seems to be that you have suffered from the "C++ works
like Java" misconception, and fixed that by removing calls that you
believed would end up in a derived class.
Well that's not something to blame C++ for.
That is what I'm saying from the start. This problem is not related to C++,
but to the general thinking of virtuals. And a related genuine, theoretic
limitation.
Languages could create different behaviors, but none of them would be good
for all the cases.