I’m wondering what is the best practice as far as a naming identifiers used in the ValueTree?
For example I have two different node types in the tree, SYNTH and OUTPUT. Each one of them has an index property. Should I create two different identifiers, SYNTH_IDX and OUTPUT_IDX or is it fine to just use a single identifier called IDX? Would there be downsides to that when trying to differentiate between them in the property changed listeners, or maybe in other scenarios?
So long as you check the ValueTree type before comparing any property IDs, I think there wouldn’t be any problems with using the same Identifier object. I’d prefer to create separate IDs just to avoid that being a potential source of errors, though.
I like to use different namespaces for each type of ValueTree node. Something like:
Using a single identifier could help keep your namespace organization tidy, as in @connorreviere’s example.
However, note that two identically named Identifiers will evaluate as being equal, even if they were created in separate namespaces. So, depending on what you need to do with them later on, it might be important to give them unique names (like your SYNTH_IDX and OUTPUT_IDX example’).