assert() vs. enforce(), invariant() vs. ... ?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Aug 30 14:11:32 PDT 2013
On 8/30/13 11:20 AM, Namespace wrote:
>> Typedef was useful not for poking around new type with same properties
>> - new name of existing type, but for non-trivial default value:
>>
>> typedef int myint = 1;
>>
>> void main()
>> {
>> myint my;
>> assert(my is 1);
>> }
>>
>> Alias does not provide this feature, so D hadn't become better with
>> this depreciation (actually the opposite). Nor it had with delete
>> operator depreciation for the replacement of destroy, which like in
>> case with typedef, does not cover full old feature functionality (and
>> functionality what destroy() does provide is useless in many cases). I
>> consider both depreciations as mistakes.
>
> Thanks for explanation. I agree that the deprecation of typedef and
> delete is/was a mistake, and IMO the deprecation of scope and the
> library fix scoped is the same mistake.
* typedef: it was so ill defined, bringing it any closer to sanity
would've broken someone's code.
* delete: a festering dung of unsafety straight in the middle of the
language. If there's enough argument that the functionality of delete is
actually desirable we can always add a function for that.
* scope: cute and dangerous in equal proportions - great for a movie
character, terrible for language design.
Andrei
More information about the Digitalmars-d
mailing list