D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20266 - __ARGS__ for easy forwarding of function arguments
Summary: __ARGS__ for easy forwarding of function arguments
Status: RESOLVED DUPLICATE of issue 22291
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-04 01:34 UTC by Andrej Mitrovic
Modified: 2022-07-04 16:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2019-10-04 01:34:59 UTC
I often find myself wanting to forward arguments to another function, most commonly for logging. For example:

-----
void setupTimer ( ulong index, ulong timer_id, Duration duration )
{
    log.trace(__FUNCTION__, index, timer_id, duration);

    ...
}
-----

But I always have to pass the parameters manually. It would be very convenient if I could write it like this:

-----
void setupTimer ( ulong index, ulong timer_id, Duration duration )
{
    log.trace(__FUNCTION__, __PARAMETERS__);

    ...
}
-----
Comment 1 Andrej Mitrovic 2019-10-04 02:03:06 UTC
I've renamed the keyword to __ARGS__, as I think that makes more sense. It's not in use currently right?
Comment 2 Andrej Mitrovic 2022-07-04 16:56:00 UTC

*** This issue has been marked as a duplicate of issue 22291 ***