Add support for using named types when creating datasets and attributes

Addresses #296.