What's up with the assert enhancements proposed years ago?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 24 02:40:48 PDT 2016


On Saturday, September 24, 2016 08:03:15 Martin Nowak via Digitalmars-d wrote:
> On Friday, 23 September 2016 at 20:57:49 UTC, Nick Sabalausky
>
> wrote:
> > were rejected because it was deemed both easy enough and
> > preferable to get these features by modifying DMD to add
> > behind-the-scenes AST magic to "assert".
> >
> > So...umm...yea...whatever happened to that beefed-up "assert"
> > feature?
>
> assertPred!"=="(a, b);
> assertPred!"!"(a);
> assertPred!(std.range.equal)(a, b);
>
> Seems to do most of what DIP83 does w/ expensive feature design,
> and compiler implementation work.
> Also http://code.dlang.org/packages/unit-threaded comes with a
> couple of test comparators, though it follows ruby rspec's bad
> idea of giving every comparator a name (which has to be learnt
> and documented).

assertPred as I had implemented it previously worked quite nicely except for
the fact that it resulted in a fair bit of compiler overhead with all of the
template stuff it was doing (I don't know how much that could be improved).
As I recall, it was generally well-liked. It was just that some folks
(Andrei included IIRC) thought that assert should be able to do at least the
basics of what assertPred did automatically, which is why it was rejected.
Since that time, there has been a greater push to do stuff in libraries
where we can rather than to make the language do more, so maybe it would go
over better today than it did then.

- Jonathan M Davis



More information about the Digitalmars-d mailing list