Steve Yegge's rant on The Next Big Language
renoX
renosky at free.fr
Tue Feb 13 13:28:24 PST 2007
Jarrett Billingsley a écrit :
> "BCS" <ao at pathlink.com> wrote in message
>>> 13. Keyword and rest parameters
>> I'm not sure what this is
>
> Keyword parameters are another thing found in python. They allow you to
> call functions with named parameters:
>
> foo(x = 5, y = 10);
>
> In python, the keyword parameters are interpreted as a hashtable, but since
> D is statically typed, it could probably just map the parameters right to
> the parameters defined in the function. I'd really like to see this.
+1
When you think about it, the current function call where parameter
passing is done by position is quite broken as shown nicely by memset:
developers make so many mistake calling it, that some compilers
integrated warnings when they see that the parameters are likely wrong..
IMHO when a function has two parameters with 'compatible' type, it
should be called by 'keyword' to avoid hard to find errors.
Plus, this really improves readability, if a bit verbose.
renoX
More information about the Digitalmars-d-announce
mailing list