raise NotImplementedError from Module.constants (15.2.2.3.1); close #1125
method function should return mrb_value
factor out redundant Regexp check into functions