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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/
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
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
Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.net http://metalu.net __ http://www.metaluachahuter.com/ http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock mail@ingostock.de:
Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/
listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
2018-05-07 10:19 GMT-03:00 Antoine Rousseau antoine@metalu.net:
In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.net http://metalu.net __ htt p://www.metaluachahuter.com/ http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock mail@ingostock.de:
Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li
stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
Correct me if I'm wrong, but the [array] objects already have [value] like behavior, in that you can have multiple objects referencing the same array. The difference is that with [value], the reference is implicit while with [array] it is explicit (ie. [array define]).
The only thing a flag could do would be to tell [array define] to accept the first instance of a particular argument and reject the rest. But this would lead to a lot of confusion since you could have lots of empty [array define]'s scattered around the place.
The best solution is surely to put the array in a parent patch of the abstraction. If you don't mind putting it there yourself, you can do as Ingo suggested. If you want it to happen automatically, then there are neat dynamic patching solutions available.
From: Pd-list pd-list-bounces@lists.iem.at on behalf of Alexandre Torres Porres porres@gmail.com Sent: 07 May 2018 15:46 To: Pd-list Subject: Re: [PD] static array/text
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
2018-05-07 10:19 GMT-03:00 Antoine Rousseau <antoine@metalu.netmailto:antoine@metalu.net>: In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.nethttp://metalu.net __ http://www.metaluachahuter.com/http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock <mail@ingostock.demailto:mail@ingostock.de>: Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.comhttp://danomatika.com http://danomatika.com robotcowboy.comhttp://robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.atmailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.atmailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.atmailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
sounds like the [clone] object is also to be considered here.
On Mon, May 7, 2018 at 5:41 PM, Liam Goodacre liamg_uw@hotmail.com wrote:
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
Correct me if I'm wrong, but the [array] objects already have [value] like behavior, in that you can have multiple objects referencing the same array. The difference is that with [value], the reference is implicit while with [array] it is explicit (ie. [array define]).
The only thing a flag could do would be to tell [array define] to accept the first instance of a particular argument and reject the rest. But this would lead to a lot of confusion since you could have lots of empty [array define]'s scattered around the place.
The best solution is surely to put the array in a parent patch of the abstraction. If you don't mind putting it there yourself, you can do as Ingo suggested. If you want it to happen automatically, then there are neat dynamic patching solutions available.
*From:* Pd-list pd-list-bounces@lists.iem.at on behalf of Alexandre Torres Porres porres@gmail.com *Sent:* 07 May 2018 15:46 *To:* Pd-list *Subject:* Re: [PD] static array/text
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
2018-05-07 10:19 GMT-03:00 Antoine Rousseau antoine@metalu.net:
In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.net http://metalu.net __ htt p://www.metaluachahuter.com/ http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock mail@ingostock.de:
Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li
stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
I didnt know you could have two [array define] with the same name without printing "warning: *arrayname*: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
2018-05-07 13:41 GMT-03:00 Liam Goodacre liamg_uw@hotmail.com:
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
Correct me if I'm wrong, but the [array] objects already have [value] like behavior, in that you can have multiple objects referencing the same array. The difference is that with [value], the reference is implicit while with [array] it is explicit (ie. [array define]).
The only thing a flag could do would be to tell [array define] to accept the first instance of a particular argument and reject the rest. But this would lead to a lot of confusion since you could have lots of empty [array define]'s scattered around the place.
The best solution is surely to put the array in a parent patch of the abstraction. If you don't mind putting it there yourself, you can do as Ingo suggested. If you want it to happen automatically, then there are neat dynamic patching solutions available.
*From:* Pd-list pd-list-bounces@lists.iem.at on behalf of Alexandre Torres Porres porres@gmail.com *Sent:* 07 May 2018 15:46 *To:* Pd-list *Subject:* Re: [PD] static array/text
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
2018-05-07 10:19 GMT-03:00 Antoine Rousseau antoine@metalu.net:
In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.net http://metalu.net __ htt p://www.metaluachahuter.com/ http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock mail@ingostock.de:
Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li
stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
well, by using [array set] it gives you the "warning: *arrayname*: multiply defined", so there you go... I say this is not "value" behaviour, as you still only have one defined array to access
2018-05-07 15:11 GMT-03:00 Alexandre Torres Porres porres@gmail.com:
I didnt know you could have two [array define] with the same name without printing "warning: *arrayname*: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
2018-05-07 13:41 GMT-03:00 Liam Goodacre liamg_uw@hotmail.com:
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
Correct me if I'm wrong, but the [array] objects already have [value] like behavior, in that you can have multiple objects referencing the same array. The difference is that with [value], the reference is implicit while with [array] it is explicit (ie. [array define]).
The only thing a flag could do would be to tell [array define] to accept the first instance of a particular argument and reject the rest. But this would lead to a lot of confusion since you could have lots of empty [array define]'s scattered around the place.
The best solution is surely to put the array in a parent patch of the abstraction. If you don't mind putting it there yourself, you can do as Ingo suggested. If you want it to happen automatically, then there are neat dynamic patching solutions available.
*From:* Pd-list pd-list-bounces@lists.iem.at on behalf of Alexandre Torres Porres porres@gmail.com *Sent:* 07 May 2018 15:46 *To:* Pd-list *Subject:* Re: [PD] static array/text
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
2018-05-07 10:19 GMT-03:00 Antoine Rousseau antoine@metalu.net:
In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.net http://metalu.net __ htt p://www.metaluachahuter.com/ http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock mail@ingostock.de:
Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li
stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
I didnt know you could have two [array define] with the same name without printing "warning: arrayname: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
The use is to warn you against using multiple [array define]'s of the same name! That's a dangerous thing to do, since you're never going to know which array is being used (unless you happen to remember which one you created first).
There are two possibilities: either you want each instance of the array to be unique. In that case, use $0. Or, you want only one array. In that case, put it outside the abstraction.
well, by using [array set] it gives you the "warning: arrayname: multiply defined", so there you go... I say this is not "value" behaviour, as you still only have one defined array to access
PD is complaining that you have multiple [array define]'s, not multiple [array set]'s. You can have as many [array set]'s of the same name as you want.
However, you're right that it seems to take an [array set] to trigger this warning message, which is a bit confusing.
From: Alexandre Torres Porres porres@gmail.com Sent: 07 May 2018 19:11 To: Liam Goodacre Cc: Pd-list Subject: Re: [PD] static array/text
I didnt know you could have two [array define] with the same name without printing "warning: arrayname: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
2018-05-07 13:41 GMT-03:00 Liam Goodacre <liamg_uw@hotmail.commailto:liamg_uw@hotmail.com>: Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
Correct me if I'm wrong, but the [array] objects already have [value] like behavior, in that you can have multiple objects referencing the same array. The difference is that with [value], the reference is implicit while with [array] it is explicit (ie. [array define]).
The only thing a flag could do would be to tell [array define] to accept the first instance of a particular argument and reject the rest. But this would lead to a lot of confusion since you could have lots of empty [array define]'s scattered around the place.
The best solution is surely to put the array in a parent patch of the abstraction. If you don't mind putting it there yourself, you can do as Ingo suggested. If you want it to happen automatically, then there are neat dynamic patching solutions available.
From: Pd-list <pd-list-bounces@lists.iem.atmailto:pd-list-bounces@lists.iem.at> on behalf of Alexandre Torres Porres <porres@gmail.commailto:porres@gmail.com> Sent: 07 May 2018 15:46 To: Pd-list Subject: Re: [PD] static array/text
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
2018-05-07 10:19 GMT-03:00 Antoine Rousseau <antoine@metalu.netmailto:antoine@metalu.net>: In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.nethttp://metalu.net __ http://www.metaluachahuter.com/http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock <mail@ingostock.demailto:mail@ingostock.de>: Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.comhttp://danomatika.com http://danomatika.com robotcowboy.comhttp://robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.atmailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.atmailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.atmailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.atmailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Here is a method where the arrays are defined within the abstractions, but every abstraction is just using the one defined in the first abstraction.
I am not sure why there is an error when you open the abstraction file on its own, as $1 should resolve to zero, but other than that the method should work fine.
best, ingo
On 05/07/2018 08:22 PM, Liam Goodacre wrote:
I didnt know you could have two [array define] with the same name without printing "warning: /arrayname/: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
The use is to warn you against using multiple [array define]'s of the same name! That's a dangerous thing to do, since you're never going to know which array is being used (unless you happen to remember which one you created first).
There are two possibilities: either you want each instance of the array to be unique. In that case, use $0. Or, you want only one array. In that case, put it outside the abstraction.
well, by using [array set] it gives you the "warning: /arrayname/: multiply defined", so there you go... I say this is not "value" behaviour, as you still only have one defined array to access
PD is complaining that you have multiple [array define]'s, not multiple [array set]'s. You can have as many [array set]'s of the same name as you want.
However, you're right that it seems to take an [array set] to trigger this warning message, which is a bit confusing.
*From:* Alexandre Torres Porres porres@gmail.com *Sent:* 07 May 2018 19:11 *To:* Liam Goodacre *Cc:* Pd-list *Subject:* Re: [PD] static array/text I didnt know you could have two [array define] with the same name without printing "warning: /arrayname/: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
2018-05-07 13:41 GMT-03:00 Liam Goodacre <liamg_uw@hotmail.com mailto:liamg_uw@hotmail.com>:
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right? Correct me if I'm wrong, but the [array] objects already have [value] like behavior, in that you can have multiple objects referencing the same array. The difference is that with [value], the reference is implicit while with [array] it is explicit (ie. [array define]). The only thing a flag could do would be to tell [array define] to accept the first instance of a particular argument and reject the rest. But this would lead to a lot of confusion since you could have lots of empty [array define]'s scattered around the place. The best solution is surely to put the array in a parent patch of the abstraction. If you don't mind putting it there yourself, you can do as Ingo suggested. If you want it to happen automatically, then there are neat dynamic patching solutions available. ------------------------------------------------------------------------ *From:* Pd-list <pd-list-bounces@lists.iem.at <mailto:pd-list-bounces@lists.iem.at>> on behalf of Alexandre Torres Porres <porres@gmail.com <mailto:porres@gmail.com>> *Sent:* 07 May 2018 15:46 *To:* Pd-list *Subject:* Re: [PD] static array/text Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right? 2018-05-07 10:19 GMT-03:00 Antoine Rousseau <antoine@metalu.net <mailto:antoine@metalu.net>>: In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable. Antoine Rousseau http://www.metalu.net <http://metalu.net> __ http://www.metaluachahuter.com/ <http://www.metaluachahuter.com/compagnies/al1-ant1/> 2018-05-07 13:47 GMT+02:00 Ingo Stock <mail@ingostock.de <mailto:mail@ingostock.de>>: Maybe you can just put the text/array object into the main file, like in the attached demo? best, ingo On 05/07/2018 12:02 AM, 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]. > > -------- > Dan Wilcox > @danomatika <http://twitter.com/danomatika> > danomatika.com <http://danomatika.com> <http://danomatika.com> > robotcowboy.com <http://robotcowboy.com> <http://robotcowboy.com> > > > > > > _______________________________________________ > Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list > UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list <https://lists.puredata.info/listinfo/pd-list> > _______________________________________________ Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list <https://lists.puredata.info/listinfo/pd-list> _______________________________________________ Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list <https://lists.puredata.info/listinfo/pd-list> _______________________________________________ Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list <https://lists.puredata.info/listinfo/pd-list>
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
I said creating 2 arrays with the same name DID NOT give a warning, so that looked like a bug to me
2018-05-07 15:22 GMT-03:00 Liam Goodacre liamg_uw@hotmail.com:
I didnt know you could have two [array define] with the same name without printing "warning: *arrayname*: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
The use is to warn you against using multiple [array define]'s of the same name! That's a dangerous thing to do, since you're never going to know which array is being used (unless you happen to remember which one you created first).
There are two possibilities: either you want each instance of the array to be unique. In that case, use $0. Or, you want only one array. In that case, put it outside the abstraction.
well, by using [array set] it gives you the "warning: *arrayname*: multiply defined", so there you go... I say this is not "value" behaviour, as you still only have one defined array to access
PD is complaining that you have multiple [array define]'s, not multiple [array set]'s. You can have as many [array set]'s of the same name as you want.
However, you're right that it seems to take an [array set] to trigger this warning message, which is a bit confusing.
*From:* Alexandre Torres Porres porres@gmail.com *Sent:* 07 May 2018 19:11 *To:* Liam Goodacre *Cc:* Pd-list
*Subject:* Re: [PD] static array/text
I didnt know you could have two [array define] with the same name without printing "warning: *arrayname*: multiply defined", and this feels like a bug to me, because what's the use case here? I treid using [array set] and it only did set one of the arrays... (the first one)
2018-05-07 13:41 GMT-03:00 Liam Goodacre liamg_uw@hotmail.com:
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
Correct me if I'm wrong, but the [array] objects already have [value] like behavior, in that you can have multiple objects referencing the same array. The difference is that with [value], the reference is implicit while with [array] it is explicit (ie. [array define]).
The only thing a flag could do would be to tell [array define] to accept the first instance of a particular argument and reject the rest. But this would lead to a lot of confusion since you could have lots of empty [array define]'s scattered around the place.
The best solution is surely to put the array in a parent patch of the abstraction. If you don't mind putting it there yourself, you can do as Ingo suggested. If you want it to happen automatically, then there are neat dynamic patching solutions available.
*From:* Pd-list pd-list-bounces@lists.iem.at on behalf of Alexandre Torres Porres porres@gmail.com *Sent:* 07 May 2018 15:46 *To:* Pd-list *Subject:* Re: [PD] static array/text
Seems like the "value behaviour" is something that could be implemented in [array define] with a new flag, right?
2018-05-07 10:19 GMT-03:00 Antoine Rousseau antoine@metalu.net:
In moonlib you can find [sarray] and [slist], which implement the [value] behaviour (i.e multiple declarations of a shared data) for array and list of symbols. They are also dynamically re-assignable.
Antoine Rousseau http://www.metalu.net http://metalu.net __ htt p://www.metaluachahuter.com/ http://www.metaluachahuter.com/compagnies/al1-ant1/
2018-05-07 13:47 GMT+02:00 Ingo Stock mail@ingostock.de:
Maybe you can just put the text/array object into the main file, like in the attached demo?
best, ingo
On 05/07/2018 12:02 AM, 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].
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li
stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
I said creating 2 arrays with the same name DID NOT give a warning, so that looked like a bug to me.
Oh yeah, I can see how that is confusing. It would be nice if you got the error message when multiple [array define]'s are loaded.
There's a tricky bit though - what when the user copy/pastes an array define object meaning to later change the name - in this case is it appropriate to print the warning? I'm not sure.
On the larger topic, I like the idea of having a "-shared" or "-s" flag to [array define]. I can think some of th details through but not all of them yet...
When there are [struct array -s -k] objects, perhaps some in abstractions and some in 'main' patches, where do the contentes get saved? Should it be the case that all "-k" instances save their contents, whether in abstractions orin 'main' patches, and then should it be considered a conflict when loading a patch causes one to be 'restored' twice?
... and incidentally, whatever is done I guess it should be that way for "value", "array", "text", and (eventually) "scalar".
The situation wih the old Max mtable object was a bit of a mess because I didn't have it thought all the way through ...
cheers Miller
On Tue, May 08, 2018 at 02:50:26AM +0000, Liam Goodacre wrote:
I said creating 2 arrays with the same name DID NOT give a warning, so that looked like a bug to me.
Oh yeah, I can see how that is confusing. It would be nice if you got the error message when multiple [array define]'s are loaded.
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list