last day (20 days later) » 

6:17 PM
17
A: In a templated derived class, why do I need to qualify base class member names with "this->" inside a member function?

curiousguyC++ answer (general answer) Consider a template class Derived with a template base class: template <typename T> class Base { public: int d; }; template <typename T> class Derived : public Base<T> { void f () { this->d = 0; } }; this has type Derived&l...

 
@BerkDemirkır added specific answer
Why the downvote???
@BerkDemirkır Added explanation for C++ template rules.
Why the other downvote?
 
There is a reason beside "the standard says so" Actually no, there is no reason. This is a design decision and is completely unrelated to late name binding as you call it (second stage lookup).
 
@DavidRodríguez-dribeas Where is the error in my reasoning?
 
@curiousguy: The whole reasoning is bogus, the problem is not with late binding, but with the fact that the standard (arbitrarily) mandates early binding of non-dependant names. As a matter of fact late binding would be performed after instantiation, and the base type would be already instantiated. Besides that, there is no clearer proof that a counter example: Visual Studio, if I am not wrong, implements late binding and does not need the extra qualification.
 
@DavidRodríguez-dribeas "but with the fact that the standard (arbitrarily) mandates early binding of non-dependant names" So, you suggest that non-dependant names could be late bound!!? How is that different from not having 2 phase at all?
 
6:17 PM
@curiousguy: You are claiming that there is a technical underlying reason, rather than an arbitrary decision in the language. I am saying that there are counter examples to that argument. The D language for sure and the Visual Studio C++ compilers clearly demonstrate that you can do otherwise and that it is indeed an arbitrary decision. Also note that the whole argument is based on the premise that it is needed for late binding, and late binding would actually be the solution, not the problem.
 
@DavidRodríguez-dribeas "You are claiming that there is a technical underlying reason, rather than an arbitrary decision in the language." Yes. This is a direct consequence of having 2 phase name lookup in member functions. "The D language for sure and the Visual Studio C++ compilers clearly demonstrate that you can do otherwise and that it is indeed an arbitrary decision." I don't know D, and I don't think it is relevant here. I don't know how the recent versions of the compiler best known for not implementing 2 phase name lookup implements name lookup, and do not care much either.
(...) I have written a proof. You have not showed a single error in it. I sincerely doubt you really understand what 2 phases is, its motives, etc. Can you answer my previous question? If not, I will take that as implicitly admitting that I am right. Anyway, do you realise how your counter argument suck badly? Seriously, a different programming language vaguely inspired by C++ and a compiler mostly known for not implementing C++....!
 
@curiousguy: You have been able to come to the issue in your reasoning by yourself: 2-phase lookup is an arbitrary decision. There is no underlying reason to do so (ask the people in the committee that you should know, having been there as you have). The original intent was trying to provide better diagnostics, but now it is believed that it is more a source of confusion than help. Now think this over slowly, read your answer and try to identify where 2-phase is mentioned (it is not). What you said is that for late name binding you need this. Precisely for late binding you don't
 
@DavidRodríguez-dribeas "2-phase lookup is an arbitrary decision." No. The motives for name binding rules are explained in D&E. It is clear in this book that BS sees the difficulty of specifying the rules for templates. He does some hand-waving, as he see the limits of this approach. "There is no underlying reason to do so" Of course there is. Please read D&E. Do you really think the committee invents rules for the sake of inventing rules? There is always some motive, however lame it can be. (Lame as: we don't have time to study this, so let's keep it simple and not general.)
(...) "(ask the people in the committee that you should know," Anyone can ask anything to former committee members, you don't have to know them personally; but you have to find one who can remember the exact arguments debated 15 years ago. OTOH, everyone can read the WG21 design documents. "having been there as you have)." I was not in the committee the first years when the big decisions were taken. (James Kanze was, and he is on SO too.)
(...) Anyway, this is not a committee invention. Please read D&E. "The original intent was trying to provide better diagnostics," now there was an intent, so it was not purely an arbitrary decision! But that was not the intent. The intent was to avoid absurd name bindings (by name "capture") in template. Please read D&E. "Now think this over slowly," lol You are being annoying and arrogant again. "What you said is that for (early) name binding you need this." Yes. You definitely have no idea what you are talking about. 2 phases = early + late. Late only is 1 phase.
 
@curiousguy: I know the rationale given in D&E, I have read the book. I also know that years later (and this comes from people that are now in the committee) the common thought is that while the intent was good, there is no real need for that and that it causes as much confusion as the alternatives. I find it interesting that now you claim that decisions are backed by motive, while last night (and in the past with other people) you claimed otherwise. BTW, you have not answered the questions I asked last night. Annoying and arrogant seems to be a trait we share.
... and we clearly agree in that we both believe the other one has no clue. Other than that, I believe that you have issues processing read text and quote through editing: What you said is that for late binding, which is what the answer says. You might not have wanted to say it, but if you carefully read it: Templates can have name that are bound late. Now the more interesting question is why am I spending time in this... when you clearly don't want to listen. So lets leave it at that: You think I have no idea, I believe it is you the one that has no clue.
 
@DavidRodríguez-dribeas "I know the rationale given in D&E" So I misread your comments when you repeatedly said it was an "arbitrary decision". Sorry about that.
"the common thought is that while the intent was good, there is no real need for that and that it causes as much confusion as the alternatives." yes, I think it is clearly a failure, and I have said so previously on SO.
"I find it interesting that now you claim that decisions are backed by motive, while last night (and in the past with other people) you claimed otherwise." Sorry you misread me. There was an original motive, but at the end we have a terrible result.
"BTW, you have not answered the questions I asked last night." which questions?
"when you clearly don't want to listen." flagged. I warned your.
"Now the more interesting question is why am I spending time in this..." because you like trolling?
"I believe that you have issues processing read text and quote through editing:" I fixed the obvious error in your message!!!!
But your message really was inane.
"Templates can have name that are bound late." Really??????????
Listen, 2 phases is what permits early name binding of non dependant names in templates.
So my answer is ENTIRELY about 2 phases.
If you don't get that, there is nothing I can do to help.
@DavidRodríguez-dribeas I think I am done with this.
I have proved you have no idea what your are talking about.
 
7:01 PM
@curiousguy That was NOT an error. You might want to reread.
@curiousguy I still wonder why you pull early into the equation, when neither my comments nor your answers talk about early binding at all.
@curiousguy You have clearly proved nothing, other than what I already stated: you have issues reading if you thought that you were fixing an error, you have preconceptions that are unwilling to revisit, won't listen to reason and have no idea of what you are talking about.
While the question that lead to this is mostly nitpicking (which you have done multiple times in the past, the whole intention was giving you a taste of your own medicine), it has clearly proven that you have issues. (Which BTW, I am not the only one that believes, so you might want to think it over).
As of the questions from last night, you were still in the chat, so you probably received notifications. If you did not, you just need to see yesterday's chat and read them.
As soon as I pressed you with facts you decided to play the I know because I was in the committee card --which seriously sounds like a bluff since you are not willing to stand by it-- and then bailed out of the discussion. If you sincerely believe, against what the documentation states, against empirical tests with compilers and against any sensible judgement that covariant return types are implemented by generating multiple versions of the same overrider in the binary...
good for you! You have proven quite a lot there.
@curiousguy BTW, I know that your answer is about the two phases, but deals with the wrong one. The issue is not as you say with late again, read late binding, not early, late as you say in the answer.
 
 
1 hour later…
8:20 PM
RAGE THREAD
 
 
1 hour later…
9:49 PM
@webarto There's a history... if you want I can provide links :)
 
@DavidRodríguez-dribeas please do
 
@webarto (From my point of view, this is of course only my opinion) this user has a history of aggressively attacking answers and downvoting without providing reasons (I fail to accept absurd statements as reason), and yesterday he pushed a button... see here
This has really gone overboard, and I am not happy about it, but heck I guess I am allowed to have a bad day!
In this particular case, he downvoted an answer that is incorrect, and rather than accepting the fact and learning he dug deeper and deeper into the absurd idea that covariance is implemented by generating multiple functions from the code, one with each possible return type. Under that assumption, the limitation covariance to reference/pointers could be lifted and could be considered arbitrary.
After trying to explain with facts, and try to lead him into understanding that his stance made no sense (and to be honest being quite tired), I picked his most voted question read it, and downvoted it for some absurd (although justifiable) motive.
The wording of his answer (the one in the link up here), claims that the decision of how lookup is performed on templates is based on sound principles and could not be done otherwise: There is a reason beside "the standard says so"
This has been proven not to be the case, by counter example (in C++ Visual Studio compiles templates, in a non-standard compliant way, but proving that it can be done otherwise). The equivalent of templates in D also avoids the whole complexity of 2-phase lookup.
Further more, in conversations with colleages in the standard committee, the issue has been brought before, and there is people in the standard that doubt this design decision. Yes, the intention was good, yes we could have done otherwise and it might be simpler and less surprising to users --just look at how many questions in SO are just about the weirdness of 2-phase lookup.
The only problem with his answer is that he omitted the fact that the requirement of two phase lookup forces the behavior (how is that not because the standard says so?). I know that much, but he is not willing to accept that his answer is not correct. Furthermore (and until now), I have avoided telling him what the small issue in his answer is, in the same way that he downvotes (I have a nice collection of his downvotes) without providing an explanation or reason.
 
10:14 PM
@DavidRodríguez-dribeas yes, you have the full right to rage on idiots, especially because you have suffered a lot to get to that 69k... and yes you can write a lot of text that makes sense. Sorry if I offended you with "RAGE THREAD" I meant all the best... now, you should come to PHP room, we get one like this per day, but we developed methods to cut idiots like this in the root... @curiousguy get a life
 
Interestingly, the more I check his answer, the clearer it is that he is missing the whole point: The real question seems to be: why isn't d bound to Base<T>::d at template definition time? No, that is not the real question, the real question is why do we need two phase lookup?
 
in PHP, 3 mins ago, by blackbee
when i was normal, i tried to bear up with people, i felt like crying to the world why no one in the helps me.... there s something wrong in me....
then i turned a psyco today... and now i want to be the worst member of this room.....
@DavidRodríguez-dribeas all I can say for sure, is that there are lots of lunatics here...
 
@webarto You did not offend me :) As a matter of fact I am using you to see if he gets the message --he does not seem to listen when people talk to him. And reputation does not have much to do here, I don't quite care for it, I like the Q&A format, and I believe that it really helps people understand a language that is not simple. Regarding rep. I have enough that he could spend his whole reputation downvoting me, and I would still have more than enough to access all of the tools.
@webarto I know, and this is only my second incident since I joined StackOverflow (which was during the beta, 3? 4 years ago?)
At any rate I am going home now.
 
there are monkeys that detect serial downvoters... he is just an anonymous that wants to prove that he is superior to someone... I probably talk rubbish but... yeah, long time ago...
 
See you around :)
 
10:21 PM
have a safe flight/trip/walk/ride home
 

  last day (20 days later) »