Hi Rachel,
thank you very much for the detailed explanation.
I see the potential problem you presented in the example.
I also understand that you have to develop a set of features that are homogeneous, while people using the library may have conflicting interests.
But, for the sake of the discussion, let me propose two possible "solutions" to this problem:
"Solution A": in my opinion some people will prefer not having to deal with a 'delete variable' command: variables could be managed either the old way or persisting them after use and having a 'clean unreferenced vars' command.
I think the usage of 'delete variable' to delete all the references in the workspace, including occurrences not currently on view, could be problematic.
Not using 'delete variable' would avoid the problem in the example.
"Solution B": Even using the 'delete variable', there should be no problems if the behaviour of the shadow variable blocks would follow the rules 1 and 2 described below.
1. On change, shadow blocks morph to regular blocks.
I know this is an already lost battle, but still a lot of the people using blockly (with shadow blocks) developed or is interested in having this behaviour.
This would solve the problems in the example you described.
But as this would not solve all the potential problems, so I would also implement the following behaviour...
2. On each creation of a shadow block (including respawn), all its variable fields get new unique names (possibly based on a common prefix or template).
I would say that this is the most sensible option in a wide range of cases.
I think users expect default inputs to be pointing to new variables, not existing ones.
In my application I had already 1 in place and I just developed 2, that one was easy (using a very simple behaviour in which for shadow blocks the initial varnames are used as prefixes to which a counter is added).
If using variable fields in shadow blocks will be explicitly forbidden I will have to extend the existing shim to override the check.
Not necessarily a big deal, depending on how the check is coded, but more stuff to maintain in sync with the Blockly version.
Best regards,
Miguel