On Wednesday, 3 May 2023 at 11:38:46 UTC, Adam D Ruppe wrote:
On Tuesday, 2 May 2023 at 13:57:23 UTC, Steven Schveighoffer
wrote:
Isn't that what `__traits(child)` is for?
https://dlang.org/spec/traits.html#child
Yes, `__traits(child, object, method_alias)(args)` is the way
to do it.
This
On Wednesday, 3 May 2023 at 11:26:00 UTC, ag0aep6g wrote:
On 03.05.23 13:13, Nick Treleaven wrote:
void fun(alias method)(C c)
{
void delegate() dg =
dg();
}
No, it doesn't. You're not using the alias. You're just
accessing `c.method` directly. If the actual method weren't
On Tuesday, 2 May 2023 at 13:57:23 UTC, Steven Schveighoffer
wrote:
Isn't that what `__traits(child)` is for?
https://dlang.org/spec/traits.html#child
Yes, __traits(child, object, method_alias)(args) is the way to do
it.
On 03.05.23 13:13, Nick Treleaven wrote:
On Tuesday, 2 May 2023 at 13:06:41 UTC, ag0aep6g wrote:
void fun(alias method)(C c)
{
void delegate() dg;
dg.funcptr =
dg.ptr = cast(void*) c;
dg();
}
This also works:
void fun(alias method)(C c)
{
void delegate() dg =
On Tuesday, 2 May 2023 at 13:06:41 UTC, ag0aep6g wrote:
void fun(alias method)(C c)
{
void delegate() dg;
dg.funcptr =
dg.ptr = cast(void*) c;
dg();
}
This also works:
void fun(alias method)(C c)
{
void delegate() dg =
dg();
}
On 5/2/23 8:52 AM, Quirin Schroll wrote:
How do I invoke the member function in a reliable way? Given `obj` of
the type of the object, I used `mixin("obj.", __traits(identifier,
memberFunc), "(params)")`, but that has issues, among probably others,
definitely with visibility. (The member
On 02.05.23 14:52, Quirin Schroll wrote:
How do I invoke the member function in a reliable way? Given `obj` of
the type of the object, I used `mixin("obj.", __traits(identifier,
memberFunc), "(params)")`, but that has issues, among probably others,
definitely with visibility. (The member
How do I invoke the member function in a reliable way? Given
`obj` of the type of the object, I used `mixin("obj.",
__traits(identifier, memberFunc), "(params)")`, but that has
issues, among probably others, definitely with visibility. (The
member function alias is a template parameter.)