[Issue 1839] New: Give D a modern varargs system that allows forwarding

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 14 19:48:42 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1839

           Summary: Give D a modern varargs system that allows forwarding
           Product: D
           Version: 2.010
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


Given function

void A(...) {
 ...
}

It should be possible to write a function wrapsA of this sort:

void wrapsA(...) {
    pre_call();
    A(...); // or whatever syntax you want for forwarding the varargs.
    post_call();
}

That D --  a supposedly modern, easy-to-use languages -- can't do this
conceptually simple thing is sad.

The whole point of procedural programming is that code is encapsulated into
reusable blocks.  Not being able to forward varargs means that a big chunk of
that reusability is lost any time you write a varargs function.  

The workaround is to write every varargs function in two flavors, one thats got
(...) args, and one that's got (_argptr,_arguments) args.  But if the solution
is so mechanical and straightforward then why can't the compiler at just do
that for us?  I'm not saying that's the right way to implement vararg
forwarding, but barring a more elegant solution, that sounds like at least a
plausible solution.


-- 



More information about the Digitalmars-d-bugs mailing list