Default argument values

Leandro Lucarella llucax at gmail.com
Thu May 20 17:57:09 PDT 2010


bearophile, el 20 de mayo a las 16:56 me escribiste:
> This page talks about default function argument values in C#4:
> http://www.lostechies.com/blogs/jimmy_bogard/archive/2010/05/18/caveats-of-c-4-0-optional-parameters.aspx
> 
> 
> Near the end it says:
> 
> >If we change the value of the optional argument from 0 to 1, we have to
> >recompile all calling code for the calling code to get the updated
> >value! For folks shipping assemblies for a living, this means that
> >optional argument values don't version well, as callers have to
> >recompile.  When I used to work for a company whose product included
> >a DLL, we avoided optional method arguments for just this reason. It's
> >not a reason not to use optional arguments, but it's important to
> >understand how they work so that you don't run into headaches later.<

I think default parameters are part of the API, if you change the API, you
have to recompile the client code.

The only problem I see is the DLL will still run if it's not recompiled,
but that can happen too with other kind of changes (like changes the enum
values a function accepts), so this is not a problem present only in
default values.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
In Minnesota there's a law
That prevents men from having sex with living fish


More information about the Digitalmars-d mailing list