Date: Fri, 18 Mar 2022 14:00:52 +0200
Hello,
I'm writing in regards the current situation with pointer to members.
First issue and most confusing perhaps is the fact that dereferencing such
pointers takes a primary expression (instead of unary). This reduces
usability significantly. When you say:
ptr.*.ptrtomember()
I strongly suspect that you don't intend to dereference the result of a
function call and even if that's the case (which will be a very obscure
case) I suspect changing current behavior will still issue diagnostics if
the code was valid before.
I guess you are getting where I'm going to with this one - I suggest
changing the syntax for pointer to member indirection operator to take a
unary instead of primary expression with minimal breaking old code impact
(I can only come to this conclusion given above thoughts).
Another suggestion, kinda on the topic, would be:
1. Adding a way to symbolize (mangle) given symbol (for easier linker
access).
2. Most significantly allowing pointer to constructor with syntax like:
auto *ptrtocnstr = &Class::Class;
auto *classinstance = new ptrtocnstr(cnstrarg0, cnstrarg1);
auto *classplacement = new (classinstance) ptrtocnstr(cnstrarg0, cnstrarg1);
The above changes would allow dynamically linking in system specific ways.
Notes:
For multiple constructors - the same way overloaded functions are
determined, based on a cast.
Thanks,
Alexander Nikolov
I'm writing in regards the current situation with pointer to members.
First issue and most confusing perhaps is the fact that dereferencing such
pointers takes a primary expression (instead of unary). This reduces
usability significantly. When you say:
ptr.*.ptrtomember()
I strongly suspect that you don't intend to dereference the result of a
function call and even if that's the case (which will be a very obscure
case) I suspect changing current behavior will still issue diagnostics if
the code was valid before.
I guess you are getting where I'm going to with this one - I suggest
changing the syntax for pointer to member indirection operator to take a
unary instead of primary expression with minimal breaking old code impact
(I can only come to this conclusion given above thoughts).
Another suggestion, kinda on the topic, would be:
1. Adding a way to symbolize (mangle) given symbol (for easier linker
access).
2. Most significantly allowing pointer to constructor with syntax like:
auto *ptrtocnstr = &Class::Class;
auto *classinstance = new ptrtocnstr(cnstrarg0, cnstrarg1);
auto *classplacement = new (classinstance) ptrtocnstr(cnstrarg0, cnstrarg1);
The above changes would allow dynamically linking in system specific ways.
Notes:
For multiple constructors - the same way overloaded functions are
determined, based on a cast.
Thanks,
Alexander Nikolov
Received on 2022-03-18 12:01:05