I have a similar solution in Context, and I rely on it so much that I have created abstractions to take care of it See the files [share] and [shared] herehttps://github.com/LGoodacre/context-sequencer/tree/master/ctxfiles. These objects are not documented, but I would be willing to explain them if it would help. ________________________________ From: Pd-list pd-list-bounces@lists.iem.at on behalf of Roman Haefeli reduzent@gmail.com Sent: 07 May 2018 08:08 To: pd-list@lists.iem.at Subject: Re: [PD] static array/text
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