On Nov 16, 2009, at 1:43 PM, Dale Johannesen wrote:> > On Nov 14, 2009, at 3:16 PMPST, Howard Hinnant wrote: > >> In many places there is code that looks like: >> >> MBBI = next(MBBI); >> >> In C++0X there is a std::next that is likely to be in scope when these >> calls are made. And due to ADL the above call becomes ambiguous: >> llvm::next or std::next? >> >> I recommend: >> >> MBBI = llvm::next(MBBI); >> >> -Howard > > "next" is a popular name; if it breaks llvm, I'd expect this standards change to break a lot of existing code. Do you really want to do that?I'm happy to open an LWG issue for you on this subject. Here are directions on submitting an issue: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#submit_issue Please don't hesitate to ask me if these directions aren't clear (I'll likely update the directions from your feedback). Here is a link to the latest C++0X draft that your issue will be directing the LWG to modify: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n3000.pdf The inclusion of next() into C++0X wasn't my proposal, nor do I have the authority to pull it. But I can open an issue if you provide it to me, and the LWG will then consider taking the action suggested by the issue. -Howard
Howard Hinnant wrote:> On Nov 16, 2009, at 1:43 PM, Dale Johannesen wrote: > > >> "next" is a popular name; if it breaks llvm, I'd expect this standards change to break a lot of existing code. Do you really want to do that? >> > > I'm happy to open an LWG issue for you on this subject. Here are directions on submitting an issue: > > http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#submit_issue >It may be premature, but a resolution for the issue would be the same thing Boost does in this case: put the function in a subnamespace and introduce it to std via using declaration. I believe this should prevent it from being found via ADL. (Or does that only work the other way round?) Sebastian
On Nov 16, 2009, at 2:54 PM, Sebastian Redl wrote:> Howard Hinnant wrote: >> On Nov 16, 2009, at 1:43 PM, Dale Johannesen wrote: >> >> >>> "next" is a popular name; if it breaks llvm, I'd expect this standards change to break a lot of existing code. Do you really want to do that? >>> >> >> I'm happy to open an LWG issue for you on this subject. Here are directions on submitting an issue: >> >> http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#submit_issue >> > It may be premature, but a resolution for the issue would be the same thing Boost does in this case: put the function in a subnamespace and introduce it to std via using declaration. I believe this should prevent it from being found via ADL. (Or does that only work the other way round?)I believe that solution would prevent ADL as you intend, and if someone submits an issue, it is not premature for the submitter to propose wording which does that. Whether or not the LWG would accept that solution is not something I could speculate on. For background: Here is a paper which mentions next/prev within the context of backwards compatibility: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2270.html And here is the proposal that contains next/prev: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2246.html which was voted in on 2007-04-20. -Howard
On Nov 16, 2009, at 10:49 AMPST, Howard Hinnant wrote:> On Nov 16, 2009, at 1:43 PM, Dale Johannesen wrote: > >> >> On Nov 14, 2009, at 3:16 PMPST, Howard Hinnant wrote: >> >>> In many places there is code that looks like: >>> >>> MBBI = next(MBBI); >>> >>> In C++0X there is a std::next that is likely to be in scope when >>> these >>> calls are made. And due to ADL the above call becomes ambiguous: >>> llvm::next or std::next? >>> >>> I recommend: >>> >>> MBBI = llvm::next(MBBI); >>> >>> -Howard >> >> "next" is a popular name; if it breaks llvm, I'd expect this >> standards change to break a lot of existing code. Do you really >> want to do that? > > I'm happy to open an LWG issue for you on this subject.Eek. I'm not sure I have enough background to be the driver on this; for example I didn't know what ADL was until I looked it up. That's why I phrased it as a question. At least you don't seem to think it's a dumb question:)
On Nov 16, 2009, at 4:42 PM, Dale Johannesen wrote:> > On Nov 16, 2009, at 10:49 AMPST, Howard Hinnant wrote: > >> On Nov 16, 2009, at 1:43 PM, Dale Johannesen wrote: >> >>> >>> On Nov 14, 2009, at 3:16 PMPST, Howard Hinnant wrote: >>> >>>> In many places there is code that looks like: >>>> >>>> MBBI = next(MBBI); >>>> >>>> In C++0X there is a std::next that is likely to be in scope when these >>>> calls are made. And due to ADL the above call becomes ambiguous: >>>> llvm::next or std::next? >>>> >>>> I recommend: >>>> >>>> MBBI = llvm::next(MBBI); >>>> >>>> -Howard >>> >>> "next" is a popular name; if it breaks llvm, I'd expect this standards change to break a lot of existing code. Do you really want to do that? >> >> I'm happy to open an LWG issue for you on this subject. > > Eek. I'm not sure I have enough background to be the driver on this; for example I didn't know what ADL was until I looked it up. That's why I phrased it as a question. At least you don't seem to think it's a dumb question:)Despite the fact that I hear dumb answers all too often, I almost never come across a dumb question. :-) -Howard