I frequently perform operations on Maps of Objects which hold private data where I do not intend to alter the structure of the Map.
Existing Solution
However, Maps are a bit clunky to work with when operating on all Elements. You must first get the list of all Keys, then use an In Place Element Structure within a For Loop and Shift Registers to operate on each Element as follows:
Potential issues with this:
- Unnecessary branch of the Map which may not be optimized by the compiler
- Excessive block diagram editing which slows down the development time involved when working with Maps
- Potential for syntactical errors due to complexity of this operation
Proposed Solution
It would be great if there were some kind of auto-associating tunnel available to For Loops:
Note that the Key is not modifiable, nor is it even available within the For Loop.
Perhaps the tunnel icons must be changed so they are not confused with shift registers. I just copied the association icon from the map datatype icons.
This level of functionality is similar to the syntactical abbreviations available in most languages which support maps as a standard data type. I originally wanted this kind of functionality for Sets as well, however modifying the values may result in structural changes to the set itself due to the uniqueness constraint. As such, this is only applicable to Map Values within For Loops.
It may not be obvious, but this kind of tunnel would not be available to While loops.
Selection
This option would be available on the block diagram through the context menu items of the Map datatype Input Tunnel to the For Loop.