D2 Closure

Nick Sabalausky a at a.a
Sun Feb 21 21:50:24 PST 2010


"Michel Fortin" <michel.fortin at michelf.com> wrote in message 
news:hlk4le$13ht$1 at digitalmars.com...
> On 2010-02-18 12:18:47 -0500, Martin Franklin 
> <martin246564 at btinternet.com> said:
>
>> Its time to dump C-like languages - I have the evidence.
>>
>> http://www.modulaware.com/mdlt28.htm
>
> Nice read... and it gives me a new feature idea for D! The article rants 
> about default parameters not being very useful when you have more than one 
> (something I agree with), then propose an improvement:
>
>> Furthermore, they do not provide a great deal of convenience. If a 
>> routine has five parameters, the last three of which are optional, and 
>> caller wants to assume the defaults for parameters 3 and 4, but must 
>> specify parameter 5, then all five parameters must be specified. A better 
>> scheme would be to have a default keyword in function calls:
>>
>> f (a, b, default, default, e);
>
> Would't that be nice to be able to use the 'default' keyword when you want 
> to use the default value for a parameter? Should be pretty trivial to 
> implement.
>

VBScript (Or maybe it's just VB6. Not sure about VB.NET) allows the above by 
doing this:

f (a, b, , , e)

That's the one thing about VB that I actually kinda liked. Of coruse, it may 
not be a perfect approach, but at least you *can* leave middle params as 
default.





More information about the Digitalmars-d mailing list