WhiteHole

WhiteHole!Base is a subclass of Base which automatically implements all abstract member functions as functions that always fail. These functions simply throw an Error and never return. Whitehole is useful for trapping the use of class member functions that haven't been implemented.

The name came from Class::_WhiteHole Perl module by Michael G Schwern.

alias WhiteHole(Base) = AutoImplement!(Base, generateAssertTrap, isAbstractFunction)

Parameters

Base

A non-final class for WhiteHole to inherit from.

Examples

import std.exception : assertThrown;

static class C
{
    abstract void notYetImplemented();
}

auto c = new WhiteHole!C;
assertThrown!NotImplementedError(c.notYetImplemented()); // throws an Error

See Also

Meta

Suggestion Box / Bug Report