Final by default?

Rainer Schuetze r.sagitario at gmx.de
Mon Mar 17 12:10:31 PDT 2014



On 17.03.2014 04:45, Marco Leise wrote:
> Am Sun, 16 Mar 2014 12:28:24 +0100
> schrieb Rainer Schuetze <r.sagitario at gmx.de>:
>
> Are we still in the same discussion?

I guess we are drifting off. I was just considering some alternatives to 
"final(false)" which doesn't work.

> The only thing I miss is that among the several ways to
> express function signatures in D, some don't allow you to
> specify all attributes. My memory is blurry, but I think it
> was function literals that I used to write stubs for runtime
> loaded library functionality.
>
>> […] though I would prefer avoiding string mixins, maybe by providing a
>> function type as prototype:
>>
>> alias export extern(Windows) void function() fnWINAPI;
>>
>> @functionAttributesOf!fnWINAPI HANDLE GetCurrentProcess();
>
> That is too pragmatic for my taste. Something that you define
> in code should be usable as is. It is like taking the picture
> of a red corner sofa just to describe the color to someone.
>
> In that specific case, why does this not work for you?:
>
> nothrow extern(Windows) {
>    HANDLE GetCurrentProcess();
> }
>

The attributes sometimes need to be selected conditionally, e.g. when 
building a library for static or dynamic linkage (at least on windows 
where not everything is exported by default). Right now, you don't have 
an alternative to code duplication or heavy use of string mixins.


More information about the Digitalmars-d mailing list