Pretty please: Named arguments

Vladimir Panteleev vladimir at thecybershadow.net
Mon Feb 28 00:21:04 PST 2011


On Mon, 28 Feb 2011 10:04:31 +0200, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On Sunday 27 February 2011 23:40:41 Bekenn wrote:
>> On 2/27/2011 11:32 PM, Russel Winder wrote:
>> > The Python mechanism relies on the fact that despatch is by name and  
>> not
>> > by signature.  Languages that dispatch by signature will have
>> > significantly greater problems!
>>
>> I don't follow; the compiler has to look up the correct function
>> signature whether you use named arguments or not.  How is this
>> significantly different?
>
> You could be linking to code where you don't _have_ the source and don't  
> _have_
> the names of the variables. It's all done by the function signature in  
> C, C++,
> Java, C#, D, etc. The names of the variables are completely irrelevant to
> calling the function, and so any linkers that follow C conventions (as  
> with
> happens with D) _must_ be able to deal with function calls based on their
> signatures. That doesn't necessarily mean that it would be _impossible_  
> to find a
> way to have named arguments in D, but it makes it _far_ harder.

I don't see the problem here. Either mangle the argument names (just as  
C++ and D mangle argument types), or just ignore this problem completely  
and use the parameter names in the function declaration.

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list