DIP6: Attributes
Steven Schveighoffer
schveiguy at yahoo.com
Tue Aug 4 18:01:31 PDT 2009
On Tue, 04 Aug 2009 17:20:53 -0400, Rainer Deyke <rainerd at eldwood.com>
wrote:
> Steven Schveighoffer wrote:
>> On Tue, 04 Aug 2009 15:56:16 -0400, Ary Borenszweig
>> <ary at esperanto.org.ar> wrote:
>>> foo(timeout=5, bar="100")
>> It could also be accomplished via a fully implemented reflection
>> library, which is my side topic for this thread branch :P
>
> No. The names of positional arguments are an implementation detail, and
> should not be exposed via reflection. Named arguments are different
> from positional arguments and require separate language support.
It works. See
http://msdn.microsoft.com/en-us/library/system.reflection.parameterinfo.name.aspx
> Consider the ambiguity caused by function overloading:
> void f(int x, string y);
> void f(string y, int x);
> f(x = 1, y = "");
That is a case where the proposed function would throw an exception.
> Consider the implications of function pointers:
> void f(int x, int y);
> void g(int y, int x);
> (cond ? &f : &g)(x = 1, y = 2);
I don't see what this has to do with reflection...
-Steve
More information about the Digitalmars-d
mailing list