variadic functions

Bill Baxter dnewsgroup at billbaxter.com
Fri Jan 4 08:48:29 PST 2008


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++.
>>
>> The other shocker to me was how kludgy and raw opApply functions look. 
>> I still find it weird that I the programmer am responsible for handing D 
>> back an int from my opApply that D generated to begin with!  It just 
>> seems wrong that I should have to be the middle man there for an 
>> implementation detail like that.  (Not to mention that the reason for 
>> that mystery int is never explained in the documentation, making it all 
>> the more perplexing).
>>
>> --bb
> 
> I totally agree.  I guess we need someone to champion a solution to these that both makes more sense and preserves efficiency.
> 
> I assume having the opApply delegate raising an exception could result in slow handling of break statements?  At the very least, an enum outlining what the return values mean would be nice.  

Oh geez, yeh.  Duh.  That's the part I forgot about in my other post: 
control flow -- getting the user's op apply to return prematurely.

> 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


More information about the Digitalmars-d-learn mailing list