Repository navigation
Conversation
**NOTE**: This targets `feature/v5`. **Motivation** - A dispatch type defined by `PRO_DEF_MEM_DISPATCH`, `PRO_DEF_FREE_DISPATCH` or `PRO_DEF_FREE_AS_MEM_DISPATCH` carries an accessor, so the function it calls also fixes the name and kind of the function exposed on a `proxy`. Providing same-name access by default is the v4 design that v5 removes. - Calling one function and exposing it under another name, or as a member instead of a free function, required a hand-written dispatch type. **Design** - `member_dispatch<"name">` calls the member function `name`, and `free_dispatch<"name">` calls the free function `name`. `member_access<"name">` defines the member function `name` on `proxy`, and `free_access<"name">` defines the hidden friend `name`. - A convention selects its dispatch type and its access type independently. The dispatch types carry no accessor, and no access type is selected for them implicitly. - `PRO_ENABLE_MEMBER(name)` and `PRO_ENABLE_FREE(name)` define the dispatch and access specializations for `name` at global namespace scope. Each name is enabled at most once per translation unit for each macro. - `free_dispatch` performs ordinary lookup from its own scope, then the namespace `pro::inline v5`, the namespace `pro` and its inline namespaces, and finally the global namespace. Argument-dependent lookup happens at instantiation. **Changes** - Added the class templates `member_dispatch`, `member_access`, `free_dispatch` and `free_access`, declared next to `operator_dispatch` so that `proxy_macros.h` stays a macro-only header, and exported them from the `proxy.v5` module. - Added `PRO_ENABLE_MEMBER` and `PRO_ENABLE_FREE` with their version-qualified forms and the ambiguity diagnostics of the other version-less macros. - Added `PRO5D_DEF_FREE_ACCESSOR` for access types that define hidden friends. - Added specification pages for the four class templates and the two macros, covering the accessor of each descriptor, the lookup rules of `free_dispatch` and module usage. - Moved the free-as-member test, the weak member dispatch of `ResourceDictionary`, the reflection traits tests and the module test onto the new types. - Replaced the shared reflection access test with a facade whose member access type combines a direct convention and a reflection and whose free access type exposes the same reflection.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
PRO_DEF_MEM_DISPATCH,PRO_DEF_FREE_DISPATCHorPRO_DEF_FREE_AS_MEM_DISPATCHcarries an accessor, so the function it calls also fixes the name and kind of the function exposed on aproxy. Providing same-name access by default is the v4 design that v5 removes.Design
member_dispatch<"name">calls the member functionname, andfree_dispatch<"name">calls the free functionname.member_access<"name">defines the member functionnameonproxy, andfree_access<"name">defines the hidden friendname.PRO_ENABLE_MEMBER(name)andPRO_ENABLE_FREE(name)define the dispatch and access specializations fornameat global namespace scope. Each name is enabled at most once per translation unit for each macro.free_dispatchperforms ordinary lookup from its own scope, then the namespacepro::inline v5, the namespaceproand its inline namespaces, and finally the global namespace. Argument-dependent lookup happens at instantiation.Changes
member_dispatch,member_access,free_dispatchandfree_access, declared next tooperator_dispatchso thatproxy_macros.hstays a macro-only header, and exported them from theproxy.v5module.PRO_ENABLE_MEMBERandPRO_ENABLE_FREEwith their version-qualified forms and the ambiguity diagnostics of the other version-less macros.PRO5D_DEF_FREE_ACCESSORfor access types that define hidden friends.free_dispatchand module usage.ResourceDictionary, the reflection traits tests and the module test onto the new types.