fix non-terminal reference
get a better name for certain contract error messages

related to PR 13665
fix bad call to raise-argument-error and use ->i instead of ->d
for the mixin contracts
extend proc-doc to support optional arguments in an ->i contract

also refactor to be able to add some unit tests
make the get/extend extension more flexible

Specifically, allow a name to be specified with an
extension such that subsequent uses of those extensions
will replace mixins instead of adding new ones