UnitedLexCorp / SimpleTalk

An implementation of HyperTalk in Ohm-js
Apache License 2.0
7 stars 1 forks source link

Current property should be an ID not an index #223

Open dkrasner opened 3 years ago

dkrasner commented 3 years ago

Main Issue

The current property on world (for stacks) and stack (for cards) is an index, i.e. it's the list order of the card that is current. This works fine with adding new stacks/cards, since indexes remain valid when a list grows, but creates issues when removing them, i.e. the current property does not behave the same way with add (function) and delete (its inverse) which is bad design bound to cause issues.

For example, if we want to allow delete current card we immediately hit race conditions, such as the one described in #217. Moreover, we are likely to have all sorts of issues if we allow for stack and card reordering on the fly, combined with adding and deleting.

Related to re-ordering as described in #182