variadic functions

0ffh frank at youknow.what.todo.interNETz
Fri Jan 4 17:28:49 PST 2008


Bill Baxter wrote:
> Jason House wrote:
>> Bill Baxter Wrote:
>>> Indeed.  It was one of my first shockers with D.  Variadic args are 
>>> one of the first things I'd be trying to make easier and cleaner if I 
>>> set out to build a better C/C++.
>>> [...]
>>> --bb
>>
>> I totally agree.  I guess we need someone to champion a solution to 
>> these that both makes more sense and preserves efficiency.
>> [...]
>> For variadic functions, using a tuple makes a whole lot more sense.  
> 
> But that doesn't really work if you want a function that you get a 
> pointer to and pass around in your code.
> 
> --bb

I know people will hate me for this, but IMHO the problem with variadic
args is not a lack of sophistication, but an abundance of the same.
In C it works because C tries to be simple and straightforward (from a
machine pov, not necessarily from a human one), while the additional
sophistry that D introduced stands in the way of a simple solution.
The simplest way to fix this would probably be to give up the array
of the _arguments. But as in these times it is practically unthinkable
(and also, I admit, not really desirable) to live without the type
information they provide, the only way out I can see is to add yet more
complexity to the D compiler to handle this as a special case.

Anyways, I don't think this is really a big issue. It's just a bit of a
surprise for those of us who are used to a simpler paradigm.

regards, frank


More information about the Digitalmars-d-learn mailing list