Extendable collection with immutable values

I’m trying to build an efficient registry of certain values, and in this case, they’re all of the same type. I’m trying to find a good candidate “object” that fits this role. The desired properties are as follows:

  1. Once a value in this registry is defined, it doesn’t change, so constant propagation should be possible at compile time
  2. The registry needs to be extendable (at least once, preferably a handful of times) at the top-level script
  3. Values can be referenced by symbols with valid variable names

The only thing that I can think of that has these properties is a

  1. Module of constants that that you simply refer through getproperty, and inserts them with “eval”. This seems like overkill.
  2. A zero-argument function registry() that returns an ImmutableDict, where registry() can be overwritten by a function extend_registry(addreg) through @eval registry() = $newreg. This should recompile any functions that use registry() and allow for constant propagation so that lookups only happen once.

Is there anything better available?

Also, this registry would probably contain a couple hundred entries. So maybe a module is the way to go here? Or even a LabelledArray @ChrisRackauckas? Ideally if the entry is inlined in the code I just want to do a lookup once at compile time and keep the result as a constant.

Why not just put a named tuple into the type domain? E.g., Val((; a = 3, b = 7)).