[PD] array vs text, avoiding duplication
João Pais
jmmmpais at gmail.com
Mon Dec 24 11:31:35 CET 2018
Do you have concrete code examples?
Already for many years I don't use any variable which doesn't have an $0-
at the start of it. This also includes data structures structs and etc.,
or there will be clashes when using abstractions.
> Hi list,
>
> I have a design consideration:
> There is a mapping abstraction where IDs of buttons are mapped to MIDI
> notes. There are different tunings.
>
> Previously I used an array to store the tunings and filled this by
> reading a text file in which the tuning was stored.
>
> Now, I do the same thing but I am using the text object. Nice thing here
> is that I can store the tuning in an object.
>
> However in both cases I want to be able to use this abstraction either
> only once or multiple times.
>
> Problem is, that if I use it multiple times the [array name] or [text
> define -k name] will be defined multiple times.
>
> Is there a smart way to solve this kind of issue?
>
> I could still use text files and load them in [array $0-name] or [text
> define -k $0-name] objects, but that doesn't strike me as particular
> elegant since they will still contain the same thing, meaning it's code
> duplication.
>
> cheers
>
> m.
More information about the Pd-list
mailing list