{"action":"created","issue":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/6812","repository_url":"https://api.github.com/repos/chapel-lang/chapel","labels_url":"https://api.github.com/repos/chapel-lang/chapel/issues/6812/labels{/name}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/6812/comments","events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/6812/events","html_url":"https://github.com/chapel-lang/chapel/issues/6812","id":245118951,"number":6812,"title":"[Review] Data Structure API","user":{"login":"LouisJenkinsCS","id":4269990,"avatar_url":"https://avatars2.githubusercontent.com/u/4269990?v=4","gravatar_id":"","url":"https://api.github.com/users/LouisJenkinsCS","html_url":"https://github.com/LouisJenkinsCS","followers_url":"https://api.github.com/users/LouisJenkinsCS/followers","following_url":"https://api.github.com/users/LouisJenkinsCS/following{/other_user}","gists_url":"https://api.github.com/users/LouisJenkinsCS/gists{/gist_id}","starred_url":"https://api.github.com/users/LouisJenkinsCS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LouisJenkinsCS/subscriptions","organizations_url":"https://api.github.com/users/LouisJenkinsCS/orgs","repos_url":"https://api.github.com/users/LouisJenkinsCS/repos","events_url":"https://api.github.com/users/LouisJenkinsCS/events{/privacy}","received_events_url":"https://api.github.com/users/LouisJenkinsCS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2017-07-24T15:30:48Z","updated_at":"2017-08-21T13:13:41Z","closed_at":null,"body":"# Data Structure API\r\n\r\nLooking for feedback and review on the API for Data Structures, chpldocs hosted [here](https://louisjenkinscs.github.io/Distributed_Queue/index.html). Below are questions that help determine the overall direction of further development of the queue.\r\n\r\n**Edit:** The chpldocs link is now updated. Old docs are [here](https://louisjenkinscs.github.io/Distributed_Queue/modules/queues/Queue.html). \r\n\r\n**Edit2:** I have removed the `QueueFactory` entirely for now.\r\n\r\n**Edit3:** Generalizing for any kind of data structures.\r\n\r\n~~## The QueueFactory~~\r\n\r\n~~Emulates [Go's 'make'](https://golang.org/pkg/builtin/#make).~~\r\n\r\n~~### Open Questions~~\r\n\r\n~~* Should we maintain an interface at all?~~\r\n  ~~* If not, then should we make each data structure a `record` instead?~~\r\n   ~~* Resilience to Change vs Flexibility~~\r\n\r\n## Proposed Additions\r\n\r\n### 'Freezing' Data Structures\r\n\r\nWhile parallel-safe data structures are desired, not all things can be done in a\r\nparallel-safe manner. For these situations, I believe the data structures should be armed with two\r\nstates: Mutable (unfrozen) and Immutable (frozen). The benefit is two-fold, as it\r\nenables optimizations such as adopting a more optimistic manner of accessing data\r\nby not contesting for locks meaning more performance, and the user has the benefit\r\nof enforcing immutability across nodes without need for external synchronization. \r\nI believe that this is the only 'safe' way to allow things like reduction, zipper, \r\nand mapping iterations without modifying the queue while providing a significant performance boost.\r\n\r\n#### Open Questions\r\n\r\n* Are the semantic changes of having dual-mode operations too confusing?\r\n* What happens to concurrent ongoing operations while freezing/unfreezing?\r\n   * Should we halt? Block until unfrozen? Make it 'implementation-defined' behavior?\r\n\r\n### Iteration\r\n\r\nIteration allows for the data structures to become more than just a simple containers, making things\r\nsuch as reductions, zipper-iterables, and mappings possible.\r\n\r\n### Open Questions\r\n\r\n* Should we allow read-only iteration or 'draining' iteration, perhaps both?\r\n   * Proposal: Based on if the data structure is 'frozen' or 'unfrozen'.\r\n\r\n### Transactional Additions\r\n\r\nAdding in bulk 'all-or-nothing' transactional approach.\r\n\r\n#### Open Questions\r\n\r\n* Should we allow adding non-scalar types? From other collections?\r\n\r\n### Operator Overloading\r\n\r\nWhile some operators can be helpful, others can be rendered irrelevant. Syntactic\r\nsugar operators such as `+=` can help produce more readable code and are easy\r\nto overload. Perhaps the `=` operator can be overloaded to perform a 'clear-and-add'\r\nkind of operation? What say you?\r\n\r\n```chpl\r\nvar queue = makeBoundedFIFO(int, 100);\r\nqueue = (1,2,3,4,5);\r\nfor i in 6 .. 100 do queue += i;\r\n```\r\n\r\n**Edit:** Removed the 'literal' part of example.\r\n"},"comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments/323741276","html_url":"https://github.com/chapel-lang/chapel/issues/6812#issuecomment-323741276","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/6812","id":323741276,"user":{"login":"LouisJenkinsCS","id":4269990,"avatar_url":"https://avatars2.githubusercontent.com/u/4269990?v=4","gravatar_id":"","url":"https://api.github.com/users/LouisJenkinsCS","html_url":"https://github.com/LouisJenkinsCS","followers_url":"https://api.github.com/users/LouisJenkinsCS/followers","following_url":"https://api.github.com/users/LouisJenkinsCS/following{/other_user}","gists_url":"https://api.github.com/users/LouisJenkinsCS/gists{/gist_id}","starred_url":"https://api.github.com/users/LouisJenkinsCS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LouisJenkinsCS/subscriptions","organizations_url":"https://api.github.com/users/LouisJenkinsCS/orgs","repos_url":"https://api.github.com/users/LouisJenkinsCS/repos","events_url":"https://api.github.com/users/LouisJenkinsCS/events{/privacy}","received_events_url":"https://api.github.com/users/LouisJenkinsCS/received_events","type":"User","site_admin":false},"created_at":"2017-08-21T13:13:41Z","updated_at":"2017-08-21T13:13:41Z","body":"Cool! I'll assume most other people would feel the same way. As well, since the 'resource leakage on breaking out of iterators' is a confirmed bug, I can probably make a warning that the user cannot break out of serial iterators early without consequence."}}
{"actor":{"display_login":"LouisJenkinsCS"}}