Make sure all checks for attributes go through a centralized function,
which checks whether attribute handling is enabled, and performs validation.
The type of the attribute is returned.
Sadly, metaprogramming is required as attributes have no sensible static getters.