Add some precondition error messages
Add const, pure, nothrow, @safe where possible

This had the consequence that format could not be used on some of
the functions.