Skip to content

Conversation

@mingxwa
Copy link
Member

@mingxwa mingxwa commented May 27, 2024

Changes

  • Split overload_types from "Dispatch" and added new named requirements of "Convention". The tables below summarizes each dimension of "Facade":
Name Description Fields
Facade Facade of runtime polymorphism convention_types: tuple-like collection of Convention
reflection_types
: tuple-like collection of Reflection
constraints: pro::proxiable_ptr_constraints
Convention Runtime calling convention dispatch_type: Dispatch
overload_types: tuple-like collection of overload signatures
Dispatch Callable type for a convention Default noexcept constructor: Creation of a Dispatch, encouraged to be trivial
operator() of arbitrary type T& and arguments: Invoke with lvalue reference of type T
[Optional] operator() of arbitrary type const P& and arguments: Invoke with the underlying pointer type
[Optional] operator() of std::nullptr_t and arguments: Default invocation behavior
accessor<P>: Accessor of a proxy type
Reflection Compile-time reflection type that can be inspected at runtime constexpr constructor of type std::in_place_type_t<P>, where P is an underlying pointer type
Accessor Accessor of proxy that can inject more APIs to improve syntax Default noexcept constructor: Creation of an Accessor, encouraged to be trivial
  • Added support for multiple reflection types.
  • Renamed PRO_DEF_MEMBER_DISPATCH into PRO_DEF_MEM_DISPATCH (and the _WITH_DEFAULT version) and removed overload types from the macro.
  • Removed overload types from macros PRO_DEF_FREE_DISPATCH (and the _WITH_DEFAULT version).
  • Replaced macros PRO_MAKE_DISPATCH_PACK(), PRO_DEF_FACADE and the 3 instantiations of pro::proxiable_ptr_constraints with a builder type pro::facade_builder implemented with pure template metaprogramming. The new syntax to define a facade is as follows:
PRO_DEF_MEM_DISPATCH(MemDraw, Draw);
PRO_DEF_MEM_DISPATCH(MemArea, Area);

struct Copyable : pro::facade_builder
    ::support_copy<pro::constraint_level::nontrivial>
    ::build {};

struct Drawable : pro::facade_builder
    ::add_convention<MemDraw, void(std::ostream&)>
    ::add_convention<MemArea, double() noexcept>
    ::add_facade<Copyable>
    ::build {};
  • Revised implementation of pro::details::dependent_t and exposed as pro::lazy_eval_t and pro::lazy_eval() to facilitate definition of a custom dispatch.
  • For dispatch built from free functions, APIs are exposed as friend functions rather than member functions.
  • Revised implementation of unit tests.

@mingxwa mingxwa marked this pull request as ready for review May 28, 2024 02:10
@mingxwa mingxwa requested review from guominrui and tian-lt May 28, 2024 02:11
@mingxwa mingxwa self-assigned this May 28, 2024
@mingxwa mingxwa added this to the P3086R3 milestone May 28, 2024
tian-lt
tian-lt previously approved these changes May 28, 2024
@mingxwa mingxwa merged commit d75d1fd into microsoft:main May 28, 2024
@mingxwa mingxwa deleted the user/mingxwa/dispatch-def branch May 28, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants