{"id":90,"date":"2008-04-28T17:50:56","date_gmt":"2008-04-28T22:50:56","guid":{"rendered":"http:\/\/alarmingdevelopment.org\/?p=90"},"modified":"2008-05-03T06:04:08","modified_gmt":"2008-05-03T11:04:08","slug":"collections-with-stable-iterators","status":"publish","type":"post","link":"https:\/\/alarmingdevelopment.org\/?p=90","title":{"rendered":"Collections with stable iterators"},"content":{"rendered":"<p>Oh oracle of the interwebs &#8211;<\/p>\n<p>I am writing a GPCE paper, and one of the contributions is a model of sequences (AKA collections) that has stable unshifting positions. Standard collections use an array abstraction where access is by integer ordinal position, which shifts under insertion and deletion. This manifests as the fact that iterators are broken by insertion and deletion operations. Linked list iterators also break under deletion.<\/p>\n<p>Does anyone know of alternative proposals with stable positions\/iterators? I don&#8217;t know of any, but I can&#8217;t be the first person to do this.<!--more--><\/p>\n<p>[Thomas lord points out Emacs markers. I also know about Operational Transformation and Darcs. But have such ideas ever been abstracted into a general purpose collection class?] <\/p>\n<p>[OK &#8211; I seem to have confused everyone. Lets say you have the sequence: {a,b,c,d}. You are iterating along and see a, then b. Just then, some other code drives by and decides to insert something at the front: {foo, a, b, c, d}.<br \/>\nOr maybe they decide to delete the first element, leaving: {b, c, d}. Then you advance your iterator. In all cases you should get c as the result, not b, not d, and not an InvalidState exception.]<\/p>\n<p>[Thanks, everyone. Got some great references to related work. Maybe I should call this &#8220;blogademics&#8221;. Some people have asked about the use case for such a thing. It is to abstract editing operations. Collaborative editors have this problem, because edits can&#8217;t be propagated when their location is unstable. Version control systems like Darcs need something like it reorder patches. And I need it to express <a href=\"http:\/\/alarmingdevelopment.org\/?p=88\">composable transformations<\/a> on code that don&#8217;t shift each other&#8217;s position.]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oh oracle of the interwebs &#8211; I am writing a GPCE paper, and one of the contributions is a model of sequences (AKA collections) that has stable unshifting positions. Standard collections use an array abstraction where access is by integer ordinal position, which shifts under insertion and deletion. This manifests as the fact that iterators &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/alarmingdevelopment.org\/?p=90\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Collections with stable iterators&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-general"],"jetpack_shortlink":"https:\/\/wp.me\/pfEnU-1s","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/posts\/90","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=90"}],"version-history":[{"count":0,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}