{"action":"created","comment":{"url":"https://api.github.com/repos/mchaloupka/tickspec/pulls/comments/225869982","pull_request_review_id":165561142,"id":225869982,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTg2OTk4Mg==","diff_hunk":"@@ -5,52 +5,50 @@ open System.Collections.Generic\n open System.Diagnostics\n open System.Reflection\n \n-type KeyValueList<'K, 'V when 'K : equality and 'V : equality> () =\n-    let mutable innerList : list<'K*'V> = []\n-\n-    /// Clears collection\n-    member this.clear() = \n-        innerList <- []\n+/// Instances storage\n+type InstanceStore () =\n+    let mutable instances : list<Type*obj> = []\n \n     /// Prepends new element\n-    member this.prepend key value =\n-        let pushToList elem inList =\n-            match inList with\n-            | [] -> [elem]\n-            | _ -> [elem] @ inList\n-        innerList <- innerList |> pushToList (key, value) \n-\n-    /// Replaces existing element\n-    member this.replace key value =\n-        let findFunc = fun (x) -> fst x = key\n-        let rec replaceInList elem findFunc inList =\n-            match inList with\n-            | [] -> []\n-            | head :: rest->\n-                if findFunc(head) then\n-                    [elem] @ rest\n-                else\n-                    [head] @ replaceInList elem findFunc rest\n-        innerList <- innerList |> replaceInList (key, value) findFunc\n+    let prepend elem inList =\n+        match inList with\n+        | [] -> [elem]\n+        | _ -> [elem] @ inList\n+\n+    /// Removes element from list\n+    let rec remove key inList =\n+        match inList with\n+        | [] -> []\n+        | head :: rest->\n+            if key = fst head then\n+                let instance:obj = snd head\n+                match instance with \n+                | :? IDisposable as d -> d.Dispose()\n+                | _ -> ()\n+                rest\n+            else\n+                [head] @ remove key rest\n \n-    /// Replaces existing or prepends new element\n-    member this.store key value =\n-        if (this.tryGetValue (key)) <> None then\n-            this.replace key value\n-        else\n-            this.prepend key value\n+    /// Stores element (existing element is removed first and the new one is prepended)\n+    member this.Store key value =\n+        instances <- instances\n+            |> remove key\n+            |> prepend (key,value)\n \n     /// Returns value for specified key\n-    member this.tryGetValue key =\n-        try\n-            let found = innerList |> List.find(fun (x) -> fst x = key)\n-            Some (snd found)\n-        with\n-        | :? KeyNotFoundException -> None\n+    member this.TryGetValue key =\n+        match instances |> List.tryFind(fun (x) -> fst x = key) with","path":"TickSpec/ServiceProvider.fs","position":36,"original_position":73,"commit_id":"651ecaee6815fcf1af1f2aa4010bcf8eaeabae28","original_commit_id":"651ecaee6815fcf1af1f2aa4010bcf8eaeabae28","user":{"login":"davehl7","id":44060123,"node_id":"MDQ6VXNlcjQ0MDYwMTIz","avatar_url":"https://avatars0.githubusercontent.com/u/44060123?v=4","gravatar_id":"","url":"https://api.github.com/users/davehl7","html_url":"https://github.com/davehl7","followers_url":"https://api.github.com/users/davehl7/followers","following_url":"https://api.github.com/users/davehl7/following{/other_user}","gists_url":"https://api.github.com/users/davehl7/gists{/gist_id}","starred_url":"https://api.github.com/users/davehl7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehl7/subscriptions","organizations_url":"https://api.github.com/users/davehl7/orgs","repos_url":"https://api.github.com/users/davehl7/repos","events_url":"https://api.github.com/users/davehl7/events{/privacy}","received_events_url":"https://api.github.com/users/davehl7/received_events","type":"User","site_admin":false},"body":"Resolved.","created_at":"2018-10-17T10:35:53Z","updated_at":"2018-10-17T10:35:53Z","html_url":"https://github.com/mchaloupka/tickspec/pull/8#discussion_r225869982","pull_request_url":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/mchaloupka/tickspec/pulls/comments/225869982"},"html":{"href":"https://github.com/mchaloupka/tickspec/pull/8#discussion_r225869982"},"pull_request":{"href":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8"}},"in_reply_to_id":225614356},"pull_request":{"url":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8","id":223245751,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzMjQ1NzUx","html_url":"https://github.com/mchaloupka/tickspec/pull/8","diff_url":"https://github.com/mchaloupka/tickspec/pull/8.diff","patch_url":"https://github.com/mchaloupka/tickspec/pull/8.patch","issue_url":"https://api.github.com/repos/mchaloupka/tickspec/issues/8","number":8,"state":"open","locked":false,"title":"Storage based on F# list","user":{"login":"davehl7","id":44060123,"node_id":"MDQ6VXNlcjQ0MDYwMTIz","avatar_url":"https://avatars0.githubusercontent.com/u/44060123?v=4","gravatar_id":"","url":"https://api.github.com/users/davehl7","html_url":"https://github.com/davehl7","followers_url":"https://api.github.com/users/davehl7/followers","following_url":"https://api.github.com/users/davehl7/following{/other_user}","gists_url":"https://api.github.com/users/davehl7/gists{/gist_id}","starred_url":"https://api.github.com/users/davehl7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehl7/subscriptions","organizations_url":"https://api.github.com/users/davehl7/orgs","repos_url":"https://api.github.com/users/davehl7/repos","events_url":"https://api.github.com/users/davehl7/events{/privacy}","received_events_url":"https://api.github.com/users/davehl7/received_events","type":"User","site_admin":false},"body":"Storage based on Dictionary replaced with storage based on F# list (order preserved)","created_at":"2018-10-16T13:15:52Z","updated_at":"2018-10-17T10:35:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17951ca0cdc5c7b083604884bcf1617a14b4b722","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8/commits","review_comments_url":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8/comments","review_comment_url":"https://api.github.com/repos/mchaloupka/tickspec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mchaloupka/tickspec/issues/8/comments","statuses_url":"https://api.github.com/repos/mchaloupka/tickspec/statuses/651ecaee6815fcf1af1f2aa4010bcf8eaeabae28","head":{"label":"mchaloupka:feature/Dispose-instances-in-reversed-order","ref":"feature/Dispose-instances-in-reversed-order","sha":"651ecaee6815fcf1af1f2aa4010bcf8eaeabae28","user":{"login":"mchaloupka","id":6637220,"node_id":"MDQ6VXNlcjY2MzcyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/6637220?v=4","gravatar_id":"","url":"https://api.github.com/users/mchaloupka","html_url":"https://github.com/mchaloupka","followers_url":"https://api.github.com/users/mchaloupka/followers","following_url":"https://api.github.com/users/mchaloupka/following{/other_user}","gists_url":"https://api.github.com/users/mchaloupka/gists{/gist_id}","starred_url":"https://api.github.com/users/mchaloupka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchaloupka/subscriptions","organizations_url":"https://api.github.com/users/mchaloupka/orgs","repos_url":"https://api.github.com/users/mchaloupka/repos","events_url":"https://api.github.com/users/mchaloupka/events{/privacy}","received_events_url":"https://api.github.com/users/mchaloupka/received_events","type":"User","site_admin":false},"repo":{"id":107256644,"node_id":"MDEwOlJlcG9zaXRvcnkxMDcyNTY2NDQ=","name":"tickspec","full_name":"mchaloupka/tickspec","private":false,"owner":{"login":"mchaloupka","id":6637220,"node_id":"MDQ6VXNlcjY2MzcyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/6637220?v=4","gravatar_id":"","url":"https://api.github.com/users/mchaloupka","html_url":"https://github.com/mchaloupka","followers_url":"https://api.github.com/users/mchaloupka/followers","following_url":"https://api.github.com/users/mchaloupka/following{/other_user}","gists_url":"https://api.github.com/users/mchaloupka/gists{/gist_id}","starred_url":"https://api.github.com/users/mchaloupka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchaloupka/subscriptions","organizations_url":"https://api.github.com/users/mchaloupka/orgs","repos_url":"https://api.github.com/users/mchaloupka/repos","events_url":"https://api.github.com/users/mchaloupka/events{/privacy}","received_events_url":"https://api.github.com/users/mchaloupka/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mchaloupka/tickspec","description":"Lean BDD framework with powerful F# integration","fork":true,"url":"https://api.github.com/repos/mchaloupka/tickspec","forks_url":"https://api.github.com/repos/mchaloupka/tickspec/forks","keys_url":"https://api.github.com/repos/mchaloupka/tickspec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mchaloupka/tickspec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mchaloupka/tickspec/teams","hooks_url":"https://api.github.com/repos/mchaloupka/tickspec/hooks","issue_events_url":"https://api.github.com/repos/mchaloupka/tickspec/issues/events{/number}","events_url":"https://api.github.com/repos/mchaloupka/tickspec/events","assignees_url":"https://api.github.com/repos/mchaloupka/tickspec/assignees{/user}","branches_url":"https://api.github.com/repos/mchaloupka/tickspec/branches{/branch}","tags_url":"https://api.github.com/repos/mchaloupka/tickspec/tags","blobs_url":"https://api.github.com/repos/mchaloupka/tickspec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mchaloupka/tickspec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mchaloupka/tickspec/git/refs{/sha}","trees_url":"https://api.github.com/repos/mchaloupka/tickspec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mchaloupka/tickspec/statuses/{sha}","languages_url":"https://api.github.com/repos/mchaloupka/tickspec/languages","stargazers_url":"https://api.github.com/repos/mchaloupka/tickspec/stargazers","contributors_url":"https://api.github.com/repos/mchaloupka/tickspec/contributors","subscribers_url":"https://api.github.com/repos/mchaloupka/tickspec/subscribers","subscription_url":"https://api.github.com/repos/mchaloupka/tickspec/subscription","commits_url":"https://api.github.com/repos/mchaloupka/tickspec/commits{/sha}","git_commits_url":"https://api.github.com/repos/mchaloupka/tickspec/git/commits{/sha}","comments_url":"https://api.github.com/repos/mchaloupka/tickspec/comments{/number}","issue_comment_url":"https://api.github.com/repos/mchaloupka/tickspec/issues/comments{/number}","contents_url":"https://api.github.com/repos/mchaloupka/tickspec/contents/{+path}","compare_url":"https://api.github.com/repos/mchaloupka/tickspec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mchaloupka/tickspec/merges","archive_url":"https://api.github.com/repos/mchaloupka/tickspec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mchaloupka/tickspec/downloads","issues_url":"https://api.github.com/repos/mchaloupka/tickspec/issues{/number}","pulls_url":"https://api.github.com/repos/mchaloupka/tickspec/pulls{/number}","milestones_url":"https://api.github.com/repos/mchaloupka/tickspec/milestones{/number}","notifications_url":"https://api.github.com/repos/mchaloupka/tickspec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mchaloupka/tickspec/labels{/name}","releases_url":"https://api.github.com/repos/mchaloupka/tickspec/releases{/id}","deployments_url":"https://api.github.com/repos/mchaloupka/tickspec/deployments","created_at":"2017-10-17T11:02:09Z","updated_at":"2018-10-16T10:15:40Z","pushed_at":"2018-10-17T08:56:07Z","git_url":"git://github.com/mchaloupka/tickspec.git","ssh_url":"git@github.com:mchaloupka/tickspec.git","clone_url":"https://github.com/mchaloupka/tickspec.git","svn_url":"https://github.com/mchaloupka/tickspec","homepage":"","size":2660,"stargazers_count":0,"watchers_count":0,"language":"F#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mchaloupka:master","ref":"master","sha":"4235905450763988fff299f09205b9b96b2e9c1c","user":{"login":"mchaloupka","id":6637220,"node_id":"MDQ6VXNlcjY2MzcyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/6637220?v=4","gravatar_id":"","url":"https://api.github.com/users/mchaloupka","html_url":"https://github.com/mchaloupka","followers_url":"https://api.github.com/users/mchaloupka/followers","following_url":"https://api.github.com/users/mchaloupka/following{/other_user}","gists_url":"https://api.github.com/users/mchaloupka/gists{/gist_id}","starred_url":"https://api.github.com/users/mchaloupka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchaloupka/subscriptions","organizations_url":"https://api.github.com/users/mchaloupka/orgs","repos_url":"https://api.github.com/users/mchaloupka/repos","events_url":"https://api.github.com/users/mchaloupka/events{/privacy}","received_events_url":"https://api.github.com/users/mchaloupka/received_events","type":"User","site_admin":false},"repo":{"id":107256644,"node_id":"MDEwOlJlcG9zaXRvcnkxMDcyNTY2NDQ=","name":"tickspec","full_name":"mchaloupka/tickspec","private":false,"owner":{"login":"mchaloupka","id":6637220,"node_id":"MDQ6VXNlcjY2MzcyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/6637220?v=4","gravatar_id":"","url":"https://api.github.com/users/mchaloupka","html_url":"https://github.com/mchaloupka","followers_url":"https://api.github.com/users/mchaloupka/followers","following_url":"https://api.github.com/users/mchaloupka/following{/other_user}","gists_url":"https://api.github.com/users/mchaloupka/gists{/gist_id}","starred_url":"https://api.github.com/users/mchaloupka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchaloupka/subscriptions","organizations_url":"https://api.github.com/users/mchaloupka/orgs","repos_url":"https://api.github.com/users/mchaloupka/repos","events_url":"https://api.github.com/users/mchaloupka/events{/privacy}","received_events_url":"https://api.github.com/users/mchaloupka/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mchaloupka/tickspec","description":"Lean BDD framework with powerful F# integration","fork":true,"url":"https://api.github.com/repos/mchaloupka/tickspec","forks_url":"https://api.github.com/repos/mchaloupka/tickspec/forks","keys_url":"https://api.github.com/repos/mchaloupka/tickspec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mchaloupka/tickspec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mchaloupka/tickspec/teams","hooks_url":"https://api.github.com/repos/mchaloupka/tickspec/hooks","issue_events_url":"https://api.github.com/repos/mchaloupka/tickspec/issues/events{/number}","events_url":"https://api.github.com/repos/mchaloupka/tickspec/events","assignees_url":"https://api.github.com/repos/mchaloupka/tickspec/assignees{/user}","branches_url":"https://api.github.com/repos/mchaloupka/tickspec/branches{/branch}","tags_url":"https://api.github.com/repos/mchaloupka/tickspec/tags","blobs_url":"https://api.github.com/repos/mchaloupka/tickspec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mchaloupka/tickspec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mchaloupka/tickspec/git/refs{/sha}","trees_url":"https://api.github.com/repos/mchaloupka/tickspec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mchaloupka/tickspec/statuses/{sha}","languages_url":"https://api.github.com/repos/mchaloupka/tickspec/languages","stargazers_url":"https://api.github.com/repos/mchaloupka/tickspec/stargazers","contributors_url":"https://api.github.com/repos/mchaloupka/tickspec/contributors","subscribers_url":"https://api.github.com/repos/mchaloupka/tickspec/subscribers","subscription_url":"https://api.github.com/repos/mchaloupka/tickspec/subscription","commits_url":"https://api.github.com/repos/mchaloupka/tickspec/commits{/sha}","git_commits_url":"https://api.github.com/repos/mchaloupka/tickspec/git/commits{/sha}","comments_url":"https://api.github.com/repos/mchaloupka/tickspec/comments{/number}","issue_comment_url":"https://api.github.com/repos/mchaloupka/tickspec/issues/comments{/number}","contents_url":"https://api.github.com/repos/mchaloupka/tickspec/contents/{+path}","compare_url":"https://api.github.com/repos/mchaloupka/tickspec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mchaloupka/tickspec/merges","archive_url":"https://api.github.com/repos/mchaloupka/tickspec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mchaloupka/tickspec/downloads","issues_url":"https://api.github.com/repos/mchaloupka/tickspec/issues{/number}","pulls_url":"https://api.github.com/repos/mchaloupka/tickspec/pulls{/number}","milestones_url":"https://api.github.com/repos/mchaloupka/tickspec/milestones{/number}","notifications_url":"https://api.github.com/repos/mchaloupka/tickspec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mchaloupka/tickspec/labels{/name}","releases_url":"https://api.github.com/repos/mchaloupka/tickspec/releases{/id}","deployments_url":"https://api.github.com/repos/mchaloupka/tickspec/deployments","created_at":"2017-10-17T11:02:09Z","updated_at":"2018-10-16T10:15:40Z","pushed_at":"2018-10-17T08:56:07Z","git_url":"git://github.com/mchaloupka/tickspec.git","ssh_url":"git@github.com:mchaloupka/tickspec.git","clone_url":"https://github.com/mchaloupka/tickspec.git","svn_url":"https://github.com/mchaloupka/tickspec","homepage":"","size":2660,"stargazers_count":0,"watchers_count":0,"language":"F#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8"},"html":{"href":"https://github.com/mchaloupka/tickspec/pull/8"},"issue":{"href":"https://api.github.com/repos/mchaloupka/tickspec/issues/8"},"comments":{"href":"https://api.github.com/repos/mchaloupka/tickspec/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/mchaloupka/tickspec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mchaloupka/tickspec/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/mchaloupka/tickspec/statuses/651ecaee6815fcf1af1f2aa4010bcf8eaeabae28"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"davehl7"}}