As reported in a question about turtle buttons and ask-concurrent, the combination of foreach and ask-concurrent is broken.
I know: the documentation warns about potentially broken ask-concurrent – so no guarentee.
The error messages do not seem to make sense. Therefore, I still report the problem.
See the accompanying text file for a description of steps to reproduce the various error messages and other behavior – expected or unexpected.
Thank you for the bug report. You’re right that ask-concurrent has some intriguing issues, but since it’s no longer a supported primitive, it’s unlikely that we’ll be able to put enough development time into it to fix all the related problems. If you really need this behavior, it is possible to replicate the behavior of ask-concurrent in pure NetLogo code, although it’s a bit more verbose. You would need to manually split up your code block into sections as described in the documentation of ask-concurrent, and then run a normal ask on each section. For example, consider the following code:
Thank you for your answer.
I understand that this does not have priority.
For equivalent code using ask instead of ask-concurrent, this is a challenge when the code under ask-concurrent contains loops and calls to other procedures, and local variables.
When the code does not use recursion – other than tail-end recursion – it is always possible in theory.
But still, it will be quite a puzzle.
I’m not asking the NetLogo team to solve this for me