Use string_ref in getDimensionOptional() for consistency

Also use default string_ref constructor in empty namespace version of
string_ref to avoid a needless call to the const char* constructor.
Minor naming cleanups for clarity and consistency