New in C#4

bearophile bearophileHUGS at lycos.com
Wed Oct 29 13:47:05 PDT 2008


Jarrett Billingsley:
> Still, "only" being able to call functions directly while using
> named/default parameters covers a _great_ majority of use cases.
> Covering the rest seems to be wasting a lot of implementation time and
> performance on something that most people honestly will not use that
> much.

I agree that implementing part of the semantics of named arguments is better than nothing. In ShedSkin for example we haven't implemented the argument syntax ** yet (pass by dictionary, not so easy to implement in C++), the full argument pass semantics in Python is quite refined:

def foo(x, y=5, *z, **w):
    print x, y, z, w

foo(10) # Output: 10 5 () {}

foo(10, 20) # Output: 10 20 () {}

foo(10, 20, 30, 40, k=2, j=3) # Output: 10 20 (30, 40) {'k': 2, 'j': 3}

Note that if D becomes more functional, then function pointers/delegates/closures become quite more commonly used. So you are limiting more than you think.

Bye,
bearophile



More information about the Digitalmars-d mailing list