digitalmars.D - Named variadic arguments
- bearophile (13/13) Jan 05 2010 Coming from this question, named variadic arguments:
- bearophile (3/5) Jan 06 2010 While that can be useful, so far I've never find an use of "typesafe var...
Coming from this question, named variadic arguments:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=18586
It's a possible way to implement something like this Python code:
def foo(x, y, **kwds):
With another kind of typesafe variadic function:
void foo(int x, int y, Box[string] kwds ...) {}
foo(1, 2, z:10, w:30);
==>
In foo kwds == ["z":box(10), "w":box(30)];
(Variant or something else can be used instead of Box.)
Bye,
bearophile
Jan 05 2010
With another kind of typesafe variadic function:
void foo(int x, int y, Box[string] kwds ...) {}
While that can be useful, so far I've never find an use of "typesafe variadic
functions for class objects" (See D docs about typesafe variadic functions). If
no one uses this feature then it can be removed from D2.
Bye,
bearophile
Jan 06 2010








bearophile <bearophileHUGS lycos.com>