Abbrevs configures a set of simple names as abbreviations for fully-qualified names. An abbreviation (abbrev for short) is a simple name that expands to a fully-qualified name. Abbreviations can be useful when working with variables, functions, and especially types from multiple namespaces: // CE
(qualifiedNames ...string)
| 303 | // abbreviation, the abbreviation wins as this will ensure that the meaning of a program is |
| 304 | // preserved between compilations even as the container evolves. |
| 305 | func Abbrevs(qualifiedNames ...string) EnvOption { |
| 306 | return func(e *Env) (*Env, error) { |
| 307 | cont, err := e.Container.Extend(containers.Abbrevs(qualifiedNames...)) |
| 308 | if err != nil { |
| 309 | return nil, err |
| 310 | } |
| 311 | e.Container = cont |
| 312 | return e, nil |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | // protoTypeRegistry is an internal-only interface containing the minimum methods required to support |
| 317 | // custom types. It is a subset of methods from ref.TypeRegistry. |