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)
| 318 | // abbreviation, the abbreviation wins as this will ensure that the meaning of a program is |
| 319 | // preserved between compilations even as the container evolves. |
| 320 | func Abbrevs(qualifiedNames ...string) EnvOption { |
| 321 | return func(e *Env) (*Env, error) { |
| 322 | cont, err := e.Container.Extend(containers.Abbrevs(qualifiedNames...)) |
| 323 | if err != nil { |
| 324 | return nil, err |
| 325 | } |
| 326 | e.Container = cont |
| 327 | return e, nil |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | // protoTypeRegistry is an internal-only interface containing the minimum methods required to support |
| 332 | // custom types. It is a subset of methods from ref.TypeRegistry. |