assert() vs. enforce(), invariant() vs. ... ?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Aug 31 10:04:53 PDT 2013


On 8/31/13 2:46 AM, Andrej Mitrovic wrote:
> On 8/30/13, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>> * typedef: it was so ill defined, bringing it any closer to sanity
>> would've broken someone's code.
>
> So it had to be properly defined in the spec and implemented.
> Meanwhile we're fighting with the Phobos Typedef and it has way more
> problems right now, some of which will likely be unsolvable. Bug
> reports:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=10872
> http://d.puremagic.com/issues/show_bug.cgi?id=10871
> http://d.puremagic.com/issues/show_bug.cgi?id=10778
> http://d.puremagic.com/issues/show_bug.cgi?id=8618
> http://d.puremagic.com/issues/show_bug.cgi?id=7777
> http://d.puremagic.com/issues/show_bug.cgi?id=7737

Most of these look approachable, and there are workarounds for the 
others. Granted, the UDT can't be made 100% like the old typedef (and 
probably that would be bad, too :o)).

>> * scope: cute and dangerous in equal proportions - great for a movie
>> character, terrible for language design.
>
> scoped() has its own quirks, for example:
> http://d.puremagic.com/issues/show_bug.cgi?id=4636
> http://d.puremagic.com/issues/show_bug.cgi?id=5115
> http://d.puremagic.com/issues/show_bug.cgi?id=10921
>
> And this last bug that was filed (10921) was a bug that was known since 2010:
> http://d.puremagic.com/issues/show_bug.cgi?id=5115#c6
>
> So 3 years later, and it's still an issue. I don't even see how Issue
> 4636 can even be fixed, there's no way for a template in another
> module to get private access to the class constructor.
>
> ---
>
> Anyway, we've deprecated old keywords, and introduced half-implemented
> library replacements. I don't see how we stand any better today than
> we did before.

Library issues are a lot easier to deal with than core language issues.


Andrei




More information about the Digitalmars-d mailing list