-------- Message d'origine --------
De : Jean-Baptiste Vallon Hoarau via SG7 <sg7@lists.isocpp.org>
Date : 24/04/2024 14:34 (GMT+01:00)
À : Aurelien Cassagnes <aurelien.cassagnes@gmail.com>
Cc : Jean-Baptiste Vallon Hoarau <jeanbaptiste.vallon@gmail.com>, sg7@lists.isocpp.org
Objet : Re: [SG7] Attributes introspection
The problem is that `logInvoke` is passed a pointer to the function at run-time, so this cannot work, reflection or not, because the only thing you can reflect on in that case is the type of the function. Even if `logInvoke` was consteval (which makes no sense for a logging function but let's pretend) you'd need 1/ something to retrieve the declaration from the pointer value 2/ reflection on attributes 3/ a way to emit arbitrary diagnostics.
I think a function is not the best tool to log a call, given that you couldn't even retrieve the name of the function being called (again, reflection or not).
This might be a good time to talk about the reflection prototype I've developed, implementing a `logInvoke` macro with it is pretty straightforward :
https://cppmeta.codereckons.com/tools/z/jPjrrqIt's a bit verbose as you can see (the parens around the injected expression should not be needed anymore in the near future), but it works.