assert() vs. enforce(), invariant() vs. ... ?
Maxim Fomin
maxim at maxim-fomin.ru
Fri Aug 30 21:55:37 PDT 2013
On Friday, 30 August 2013 at 21:11:32 UTC, Andrei Alexandrescu
wrote:
>
> * typedef: it was so ill defined, bringing it any closer to
> sanity would've broken someone's code.
I haven't heard about any specific troubles with typedef which
are reason to depreciate the feature. In addition to typedef some
other features are also experiencing troubles (shared, ref,
properties, invariants,..) yet they are not deprecated.
> * delete: a festering dung of unsafety straight in the middle
> of the language.
It was useful to delete class objects at the time where
programmer knew that he can delete safely to mitigate the problem
of dangling references upon class finalization (by invoking dtor
when objects are alive). Right now there is no way to do that. By
the way, currently dmd accepts putting @safe attribute on class
dtor definitions which access GC objects - this is a hole in
@safety (accessing such elements is not a sufficient reason to be
hole in safity, but not reseting pointers to null is).
> If there's enough argument that the functionality of delete is
> actually desirable we can always add a function for that.
Probably yes.
> * scope: cute and dangerous in equal proportions - great for a
> movie character, terrible for language design.
>
>
> Andrei
I cannot remember any feature implemented in phobos that was
better then built-in language construct, including scope. Hasn't
C++ followed the same policy and at the end it was considered as
mistake? At least D has many built-in features comparing to C++
and this is advertized as an advantage.
More information about the Digitalmars-d
mailing list