variadic functions

Jarrett Billingsley kb3ctd2 at yahoo.com
Fri Jan 4 17:50:40 PST 2008


"0ffh" <frank at youknow.what.todo.interNETz> wrote in message 
news:flmmgh$24hb$1 at digitalmars.com...

>
> 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.

What would make most sense to me would be if there were a built-in variant 
type, or maybe a library-provided (library-extended?) variant type.  Then 
variadic functions just become a flavor of typesafe varidic functions with 
some implicit casting to Variant.  Then you can mess around with the array 
of args, change the values, change the size of the array, save it somewhere, 
pass it along, pass a slice along etc. 




More information about the Digitalmars-d-learn mailing list