Flag proposal

Steven Schveighoffer schveiguy at yahoo.com
Fri Jun 10 15:02:33 PDT 2011


On Fri, 10 Jun 2011 17:34:34 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 6/10/11 4:28 PM, Andrej Mitrovic wrote:
>> On 6/10/11, Lutger Blijdestijn<lutger.blijdestijn at gmail.com>  wrote:
>>> Changing a name will now break client code.
>>
>> The flag template suffers from the same issue.
>
> Actually, not. The name used with Flag is part of its type. Even in a  
> separate compilation approach, the type names must match, which is not  
> the case for parameter names.

No, it's not the same, which actually can be viewed as a plus for named  
parameters.  A named parameter call reduces to a normal call with boolean  
args, which is binary compatible, even if you change the name of the  
parameter.

A Flag! requires a recompile as well as a source change.  For things like  
fixing typos, the binary compatibility might be good.  For example, if you  
have a typo in the name of a Flag parameter in library version 1, you can  
never change the name and be backwards compatible with someone who has an  
old version of the library they are compiling against.  The Flag makes it  
*more* a part of the API than named parameters.

-Steve


More information about the Digitalmars-d mailing list