Jump to page: 1 2 3
Thread overview
Will D ever get optional named parameters?
Oct 13, 2014
岩倉 澪
Oct 13, 2014
Walter Bright
Oct 13, 2014
John Colvin
Oct 13, 2014
岩倉 澪
Oct 13, 2014
Paulo Pinto
Oct 13, 2014
Jacob Carlborg
Oct 13, 2014
Ary Borenszweig
Oct 13, 2014
Walter Bright
Oct 13, 2014
Meta
Oct 13, 2014
Cliff
Oct 13, 2014
Shammah Chancellor
Oct 14, 2014
Ary Borenszweig
Oct 14, 2014
岩倉 澪
Oct 15, 2014
ketmar
Oct 15, 2014
bearophile
Oct 15, 2014
岩倉 澪
Oct 13, 2014
Russel Winder
Oct 13, 2014
ketmar
Oct 14, 2014
岩倉 澪
Oct 13, 2014
ponce
Oct 13, 2014
ketmar
Oct 13, 2014
bachmeier
Oct 13, 2014
bearophile
Oct 13, 2014
Walter Bright
Oct 15, 2014
Rei Roldan
Oct 17, 2014
bearophile
Oct 20, 2014
岩倉 澪
October 13, 2014
From what I've found, there was some work on this in the past (http://forum.dlang.org/thread/wokfqqbexazcguffwiif@forum.dlang.org?page=6#post-thclpgdlfxxhhfklwsoj:40forum.dlang.org), but a pull request was never made/I don't seem to find discussion about adding it as a feature anywhere.

I think optional named parameters would be a nice addition, either to the core language, or something like the monadic solution from that old thread in phobos.

Are there good reasons not to add something like this to the language, or is it simply a matter of doing the work? Has it been discussed much?
October 13, 2014
On 10/13/2014 1:29 AM, "岩倉 澪" wrote:
> Are there good reasons not to add something like this to the language, or is it
> simply a matter of doing the work? Has it been discussed much?

Named parameters interact badly with overloading.
October 13, 2014
On Monday, 13 October 2014 at 08:48:11 UTC, Walter Bright wrote:
> On 10/13/2014 1:29 AM, "岩倉 澪" wrote:
>> Are there good reasons not to add something like this to the language, or is it
>> simply a matter of doing the work? Has it been discussed much?
>
> Named parameters interact badly with overloading.

How so? Can't the overload just be calculated on the subset of arguments that are given?
October 13, 2014
On Monday, 13 October 2014 at 08:48:11 UTC, Walter Bright wrote:
> Named parameters interact badly with overloading.

Good point, I hadn't thought of that!

October 13, 2014
On Monday, 13 October 2014 at 08:48:11 UTC, Walter Bright wrote:
> On 10/13/2014 1:29 AM, "岩倉 澪" wrote:
>> Are there good reasons not to add something like this to the language, or is it
>> simply a matter of doing the work? Has it been discussed much?
>
> Named parameters interact badly with overloading.

Why? Both C# and Ada support overloading and named parameters.

--
Paulo
October 13, 2014
On Mon, 13 Oct 2014 08:29:40 +0000
"岩倉 澪" via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> I think optional named parameters would be a nice addition, either to the core language, or something like the monadic solution from that old thread in phobos.
if we'll add proper AA literals, they can be used instead. methinks.


October 13, 2014
On 13/10/14 10:47, Walter Bright wrote:

> Named parameters interact badly with overloading.

Nothing says that named parameters means that you can pass the arguments in any order. The linked forum post points to an implementation that requires the arguments to be passed in the regular order.

-- 
/Jacob Carlborg
October 13, 2014
On 10/13/14, 5:47 AM, Walter Bright wrote:
> On 10/13/2014 1:29 AM, "岩倉 澪" wrote:
>> Are there good reasons not to add something like this to the language,
>> or is it
>> simply a matter of doing the work? Has it been discussed much?
>
> Named parameters interact badly with overloading.

Could you give an example?
October 13, 2014
On 13/10/14 09:47, Walter Bright via Digitalmars-d wrote:
> On 10/13/2014 1:29 AM, "岩倉 澪" wrote:
>> Are there good reasons not to add something like this to the language, or is it simply a matter of doing the work? Has it been discussed much?
> 
> Named parameters interact badly with overloading.

Groovy handles this OK.

(Python handles this fine by not having even a whiff of the
possibility of overloading ;-)

- --
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip:
sip:russel.winder@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
October 13, 2014
On Monday, 13 October 2014 at 08:29:42 UTC, 岩倉 澪 wrote:
> From what I've found, there was some work on this in the past (http://forum.dlang.org/thread/wokfqqbexazcguffwiif@forum.dlang.org?page=6#post-thclpgdlfxxhhfklwsoj:40forum.dlang.org), but a pull request was never made/I don't seem to find discussion about adding it as a feature anywhere.
>
> I think optional named parameters would be a nice addition, either to the core language, or something like the monadic solution from that old thread in phobos.
>
> Are there good reasons not to add something like this to the language, or is it simply a matter of doing the work? Has it been discussed much?

Work-around I see a lot in C++:

---------------

bool filled = true;
drawCircle(filled);

---------------

instead of:

---------------

drawCircle(true);

---------------


« First   ‹ Prev
1 2 3