Associative parameters
Bill Baxter
dnewsgroup at billbaxter.com
Tue Jul 10 13:10:31 PDT 2007
Greg wrote:
> Walter Wrote:
>
>> "Sefan Zobel" <Sefan_member at pathlink.com> wrote in message
>> news:d9n5i9$aad$1 at digitaldaemon.com...
>>> In article <d9lnrr$26q3$1 at digitaldaemon.com>, Chris Sauls says...
>>>> In python, you would do something like this:
>>>>
>>>> # foo (
>>>> # x = someX ,
>>>> # y = someY ,
>>>> # z = someZ
>>>> # )
>>>>
>>>> Now isn't that just nifty?
>>>
>>> This is also called "named parameters" in some languages (since parameters
>>> are resolved by name, not by position). And, yes, I like it too :)
>> Named parameters are problematic when overloading is thrown into the mix.
>>
>>
> What is problematic? I used named parameters with Ada and I'm not aware of any problems with it.
> In addition to making the code easier to read, named parameters avoid the burden of creating "dummy" functions when some parameters are optional.
> I found nothing on the net telling that python's or ada's implementation of named parameters is problematic.
> Can someone confirm/infirm on this point?
I don't know about Ada, but Python doesn't have function overloading.
A given module can only have one function called 'foo'.
But I do recall reading an essay/rant somewhere talking about how
sometimes just picking one way to do something makes life easier for
everyone, and the handling of function overloading was mentioned. I
think it mentioned Ada's way and Python's way specifically.
Unfortunately I can't seem to find it now.
--bb
More information about the Digitalmars-d
mailing list