thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4344
Posted: 03:58pm 22 Feb 2022
Doesn't solve the problem ;-)
1. DATA works by maintaining a global pointer to the next piece of DATA to be READ. 2. RESTORE can set the pointer. 3. There is no mechanism for user code to read the pointer, only the DATA it points at.
The result is that if I write a piece of code that calls a SUB or FUNCTION (potentially from a 3rd party, i.e. a library) then it may change the global pointer and there's nothing either the caller or the callee can do about it except religiously ensure that every set of READs starts with a RESTORE and that within a set of READs they don't call any code out of their control which might change the global pointer.
It's not an MMBasic specific problem it's just a flaw in the whole BASIC DATA/READ feature that is irrelevant for small atomic single-developer programs.
Anyway I've moved past the point of expecting Peter to do anything about it. I knew there was a reason I was avoiding involvement in MMB4W .