New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vulkan.h collision with future C++ keyword #568
Comments
I don't think the C++ committee is going to choose or not choose to keyword The question is really how can Vulkan get out of C++'s way on this. Would it be possible to create a |
the names of the fields in pod structs don't really matter, only the order and sizes. So a rename would be the simple option |
We noted this discrepancy last week in fact, and are looking into it. I'm not sure what the agreed upon resolution was because for some reason it didn't get written into the internal bug, but I know there is a resolution here which wasn't just "tell C++ to go away". Note that @ratchetfreak is correct though - the binary interface is preserved if we renamed the struct member, so existing projects using the current header would continue to work. Only developers updating the header would have any issues, and the expectation is that this member is likely not referenced in too many places throughout anyone's codebase (so impact should be small). I'll try to keep you posted when we've agreed a resolution on this one. |
We have submitted this paper to the C++ Std as to object to the naming, as this is really the last chance when they are triaging Modules Ballot comment from the National Body and each nation/company has a lot of power to change it at this moment. Please consider asking your company rep to support this paper at the next C++ Std meeting in Albuquerque on Nov 6-11. |
@fraggamuffin With due respect, there is some hierarchy of things. Language takes priority over API. |
@krOoze I don't think anyone is proposing to not add the feature here? In fact, anyone saying that is mad IMO - it's LONG overdue. The issue is simply the way the keyword is being added as fully reserved rather than contextual - which is the subject of the proposal - not outright removal. As pointed out in the proposal, lots of other projects use the word module as well, we're not the only ones. Making the keyword contextual would basically let us have our cake and eat it, though I do wonder if there are any drawbacks... |
@TobiasHector I see. My concern was so that the c++ does make the keyword something obscure or long in C++20.
It means it is a good, descriptive keyword. Otherwise nobody would use it in the first place.
Probably more complicated tokenizer. There is a reason C++ have reserved keywords in the first place. |
The main drawback is that it may not be reasonably possible. C++'s current contextual keywords, Making It's not impossible for compilers to do this, of course. But considering that the "soft keyword" idea was ultimately rejected by the committee, odds are that the committee would either keep the |
Frankly I don't think there's a particularly good option here, just a selection of vaguely bad ones. I'll let the C++ committee figure out what they think is best, but no harm in presenting proposals to them. If they decide "actually yes this is fine to make contextual", then there's no issue. If they don't make that decision, then we (and other projects) will rename a bunch of things, breaking source compatibility, but maintaining binary compatibility (which probably isn't the hugest deal). |
It'll be fun if it turns out any of those projects use "module" as a function or class name though 🤔 |
Thanks for the great discussion here. Its very healthy to see these different points of view even within Vulkan. I learned a few things I didn't know or had forgotten. The same is also true within the C++ Std. In this case and in many other C++ design decisions, the decision is tough no matter which way you cut it (paraphrasing Tobias) and thats why the experts don't all agree (and why we are not paid minimum wage:) . At the end, C++ will have to weigh how much changes will be required of the outside and of C++ implementations. They may have already considered this, but sometimes presenting new data can sway the hard borderline decisions. I and others have done this in the past, and from a timing perspective, this is the only real window (when ballot is being returned and comments to the TS is reviewed) so why not try it. |
@fraggamuffin @TobiasHector Alright. But if they standardize something like |
I will gladly take the fall if they actually call it |
@TobiasHector PS: C++ is probably a "binding" in respect to Vulkan. So I think you would be within your rights to change the parameter name if C++20 is detected (though it would still be a problem for experimental PS: Alternatively make the user choose through e.g. |
Well, it's interesting to see that what started as "not sure if anyone noticed so let's mention it somewhere" started so much discussion. From the start I was wondering why Modules TS took the path of normal instead of contextual keyword. I get that those are harder to define (for reasons mentioned above), but it seems like something that would break less existing code, which, to me, would have been worth the effort. Anyway, I just noticed that this has been discussed at the WG21 meeting this week, so I was wondering what is the current status. @TobiasHector If @krOoze I have to say, the macro approach seems like the most reasonable one to me (assuming module remains non-contextual keyword). Given how there already are things like |
However please take into account the fact that Vulkan is supposed to be just an ABI, ie. a set of functions with precise names, and that Therefore deprecating functions and adding new ones because of this keyword problem is totally wrong from a purely theoretical point of view. |
I think we can all be happy that ABI compatibility is not affected by this and, given that C++ uses snake_case while Vulkan went with vkCamelCase, it should be safe for some time to come. Although, I am a bit worried about proposals to deprecate POD ... |
Don't be. They're deprecating the term Plain Old Data, and it's being deprecated due to lack of use. From National Body comment US 101:
The reason this is the case has to do with changes made in C++11. During that process, the committee looked at the concept of POD and realized that it was very much overspecified. It conflated two distinct concepts that didn't really need to be joined. So C++11 split POD into two constructs that are fundamentally unrelated to each other: the ability to But these are essentially orthogonal. The layout of a class doesn't change just because you have a user-defined copy constructor. So the guarantees that standard layout can provide will still be guaranteed in such cases. Likewise, the ability to As such, the standard since C++11 almost never refers to types that have the combination of these two features. Just do a search in the standard for "POD"; it's almost never referenced. C++ is more likely to talk about the components of POD (triviality and standard layout) than their intersection. Even C features like So it's not that C++ is losing any particular feature. It's just a wording change; they found a better way to describe the concept, which more types can fit into. And there's no reason to specify the behavior for the intersection of these features, since they're orthogonal to each other. |
@NicolBolas Thanks for clarification. I thought that was the case and you've confirmed it for me. I just don't trust my understanding of standardese enough to feel confident. :) |
@krolli Header config macros are evil. But as you say, considering there already are some... (though in #313 I was proposing a way to get rid of For fun, let's have us a PR to that effect: #616 I notice there is proposal already in C++: P0795R0 |
@krOoze Yeah, it's the proposal that @fraggamuffin mentioned above. :)
I'm honestly not sure this is the way to go in this case. There are too many things about modules that are not clear to me yet, most having to do with build systems rather than C++ syntax. |
You cannot reasonably treat modules as though it were some kind of dialect of C++. It will be a long time before applications can reasonably be "all modules" or "all not modules". During that period, some libraries will use modules in some places. Some applications will use modules in some places. This will be a transition, not some kind of clean break. And therefore, you still need to be able to generate a Normally, my feeling is that language binding generators need to take into account the possibility that Vulkan will create identifiers that conflict with language keywords. That it is not the Khronos group's responsibility to check every identifier with every language's keywords. But C++ is a special case because, unlike most languages that can interface with C, it interfaces with C directly. It can consume (carefully coded) C headers as if they were C++ headers. And therefore, C++ users of Vulkan have every right to expect to be able to consume the C headers for Vulkan. |
Well, it consumes C++ headers. C only happens to be mostly C++ subset. Anyway, |
So @fraggamuffin is rather busy so hasn't had a chance to update this bug, but I managed to grab him for a bit and he confirmed that the C++ committee agreed to make "module" into a contextual keyword, for apparently a number of reasons, and there was some commitment to make this change to any implementations quickly. In light of that decision, we believe there is no reason to make any change to the Vulkan specification or headers. The only remaining issue is for anyone using the experimental features in VS 2017, but as these are experimental features and not intended to be bug free, we don't plan to make any changes in order to make those work. If anyone needs it to work, a simple rename from "module" to any other sane unique identifier in the header will function correctly, but we don't intend to pull that into the core header. I will close this issue, and will similarly close #616, based on that resolution. @krolli if you have any remaining issues, please feel free to comment again here (re-opening if appropriate) or raise a new issue. |
Hello, |
Yes, I have confirmed they have reversed their decision. I am trying to
chase it down as to the reason why. More later.
…On Tue, Jun 5, 2018 at 7:58 AM, Felix Hellmann ***@***.***> wrote:
Hello,
While the proposal by @fraggamuffin <https://github.com/fraggamuffin>
(p0795r0) has met consensus in Albuquerque the concrete follow up poposal
(P0924r0) has been voted against. So in it's current form the Module TS and
C++20 is still reserving 'module' as non-contextual keyword. Which
invalidates the reason to close this ticket.
Therefore I propose for this ticket to be re-opened.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#568 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGGQSc2owHJmmTbrGCqSTq18_AlAye6Aks5t5nJ4gaJpZM4Ph14R>
.
|
Re-opening issue so that it stays on our radar and doesn't just catch us off guard in however many months/years. |
Instead of breaking code bases that already exist yet while preserving the use of this as a key word. The C++ language forbids the use of identifiers that begin with an |
@skilz80 Why though butcher our beloved language over something that can be refactored in the codebase in 10 seconds? PS: fwiw in current working draft |
@krOoze Oh okay it looked or appeared to be a key word, didn't realize it was an identifier with special meaning, I might of thought that at first because of Visual Studios context highlighting. But it was just a thought though. There is nothing wrong with the language, but if was prefixed with a single _ since all names that start with _ are reserved for both the language and for different compilers that would leave the identifier module available for anyone to use it for naming any of their components within their code base without any conflicts. That is all I was saying. I know that Khrono could easily change their member's name, but there may be 100's or even 1000's of other libraries out there that might of done the same so that would mean if it conflicts with existing code; that would require 100,000's to 1,000,000's of pieces of software having to be update. But then the argument can go the other way too. If the special identifier were to be changed via an update to one's compiler then any code that was using that compiler flag would then have to be updated too... So in the end I think it would left up to first the C++ standard, then to the Compilers then finally to the Libraries - APIs... |
@skilz80 Point of order:
In C++, names prefixed with two underscores, or an underscore followed by a capital letter, are reserved for implementations for any use (macros, keywords, etc). Names prefixed with a single underscore are reserved only for global namespace identifiers. As such, users are allowed to use them for anything that wouldn't conflict with a global name (an in-struct identifier, a function parameter, local variable, etc). In any case, while the ISO C committee is willing to prefix names with |
This can be closed. The only restrictions on C++ identifiers using the word |
Closing - thanks for the update @hannes-harnisch ! |
Hi,
I was just experimenting with C++ modules under Visual Studio in an existing codebase that uses vulkan, and I ran into problem with VkPipelineShaderStageCreateInfo as it has member named 'module'. According to current version of the TS for modules, 'module' is likely to become a keyword in the language and so this produces a bunch of errors.
I'm unsure whether to bring this up with C++ people or here, but since I don't know of any place to report this for C++, I thought I'd start here. C++ folks probably know that adding new keywords will break stuff, so I guess this wouldn't be news for them anyway.
The text was updated successfully, but these errors were encountered: