www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20266] New: __PARAMETERS__ for easy forwarding of function

https://issues.dlang.org/show_bug.cgi?id=20266

          Issue ID: 20266
           Summary: __PARAMETERS__ for easy forwarding of function
                    arguments
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com

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__);

    ...
}
-----

--
Oct 03 2019