Address @bgrant's comments.

Also raises an exception if we try to register a function with a
context that clashes with a protected function name.