Pretty please: Named arguments
Bekenn
leaveme at alone.com
Tue Mar 1 11:22:17 PST 2011
On 2/28/11 1:38 PM, Don wrote:
> 1. It makes parameter names part of the API.
I wrote earlier that this would probably be the first time parameter
names "leaked" into user code, but I was wrong. Jacob Carlborg has
pointed out his library implementation of this feature:
http://dsource.org/projects/orange/browser/orange/util/Reflection.d#L135
If you look through his implementation, you'll see that it uses the
.stringof property to extract parameter names from the function
definition. In essence, parameter names are /already/ part of the API,
because code can be written that depends on them. And the fact that a
library implementation exists specifically to facilitate the use of
named arguments implies that code already /has/ been written that
depends on parameter names.
Like it or not, parameter names are already part of the API. Adding
named arguments as a language feature doesn't change that.
More information about the Digitalmars-d
mailing list