version(deprecated)?

Iain Buclaw ibuclaw at ubuntu.com
Sun Nov 4 13:45:47 PST 2012


On 4 November 2012 17:27, Alex Rønne Petersen <alex at lycus.org> wrote:
> On 04-11-2012 16:48, monarch_dodra wrote:
>>
>> I'm wondering if there is a way to know you are in deprecated mode or not?
>>
>> The deprecated attribute is great, because it gives a clear compile
>> error (as opposed to a static if, which just hides the function
>> completely).
>>
>> But the attribute alone is not enough: I have a class with a deprecated
>> method, which consumes a book-keeping attribute: Not only will this
>> attribute exist even though it has become useless, but the other
>> functions will keep updating this attribute, even though it has no more
>> consumers.
>>
>> What's more, I'd still want to unittest that function, but obviously,
>> only when compiled in "-unittest -d".
>>
>> So I have a problem.
>>
>> --------
>> Finding out if the compilation mode is deprecated is easy enough:
>>
>> //----
>> deprecated @property void deprecateExists(){}
>> enum deprecatedActive = is(typeof(deprecateExists));
>> //----
>>
>> The thing is it's kind of dirty, and I wouldn't want to have to copy
>> paste this in all of my modules, just to know whether or not deprecation
>> is active...
>>
>>
>> --------
>> We've currently implemented "version(assert)" and "version(debug)". Do
>> you think we should request having a "version(deprecated)"? I think it
>> would be very helpful. Thoughts?
>>
>>
>
> https://github.com/D-Programming-Language/dmd/pull/1257
>
> --
> Alex Rønne Petersen
> alex at lycus.org
> http://lycus.org


I fail to see the use case.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list