On Mon, 2018-05-07 at 00:02 +0200, Dan Wilcox wrote:
Is there one way to define a "static" table or text data that can be shared among abstractions? I have a few abstractions which use lookup tables and I realize now that they are basically creating a copy with each instance when they could really share the same data directly. I suppose this would be somewhat related to [value].
Sounds like that this is such a common pattern that it would deserve a built-in solution.
In netpd, abstractions/instruments can call/create a [unpatch-singleton <some_container>] whereas <some_container> is an arbitrary abstraction holding a look-up table or similar that should be only instantiated once. [unpatch-singleton] creates exactly one copy of <some_container> and it creates it in a subpatch of the unpatch instrument manager. This way <some_container> persists for the whole session even if the instrument that initially created it is closed.
https://github.com/reduzent/netpd
Roman