Simplified parameter bindings and type projection #2775
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This update simplifies a few notable areas of code generation and type projection:
The distinction between compile- and run-time convertible parameters has been removed from the generated parameter bindings and pushed down into the type traits themselves. Practically that means that there is no longer the confusing difference between the
IntoParam
andTryIntoParam
constraints.The
ComInterface
andInterface
traits have been combined. The distinction only matters for a small number of non-IUnknown
interfaces, but the divide caused a great deal of complexity. The singleInterface
trait now handles both. Thecast
method will howeverpanic
if called from a non-IUnknown
interface for obvious reasons. The branching is a compile-time decision so the unused branch should be compiled away.A lot more of the boilerplate code around COM interface declarations is now hidden behind simplified macros which makes the code a lot easier to read and substantially more concise.
This also fixes #2759