Pretty please: Named arguments

Steven Schveighoffer schveiguy at yahoo.com
Wed Mar 2 08:01:34 PST 2011


On Wed, 02 Mar 2011 10:06:17 -0500, Jason E. Aten <j.e.aten at gmail.com>  
wrote:

> On Wed, Mar 2, 2011 at 8:45 AM, Jim <bitcirkel at yahoo.com> wrote:
>>
>> In addition to that, named template arguments would allow you to create
>> very customizable, yet lean types. It would be possible to parameterize  
>> all
>> components. Basically, if you're not pleased with the default search
>> algorithm or container type of a more complex object then you can  
>> specify
>> your own.
>>
>
> Interesting, I hadn't considered the benefits of template arguments with
> names as far as leanness of types.
>
> The best part of naming arguments for functions and methods, in my
> experience, is that if you add additional arguments to a method, it is a
> cheap change. I don't have to go and find and change all the client calls
> that have already been written. I can leave all of the existing source  
> with
> client code untouched, and only specify the new parameter in the new
> invocation that wants to use the new functionality.  I only have to
> recompile.  Low maintenance.  Nice.

This isn't as dynamic as you think.  If you change a function's argument  
types or count, the client must recompile.  However, their code shouldn't  
have to change.

-Steve


More information about the Digitalmars-d mailing list