{"comment":{"url":"https://api.github.com/repos/web2solutions/Veritaseum-proof-of-concept/comments/13528775","html_url":"https://github.com/web2solutions/Veritaseum-proof-of-concept/commit/860e456118b910b6fde33d56ab928ef8031bc81f#commitcomment-13528775","id":13528775,"user":{"login":"web2solutions","id":684249,"avatar_url":"https://avatars.githubusercontent.com/u/684249?v=3","gravatar_id":"","url":"https://api.github.com/users/web2solutions","html_url":"https://github.com/web2solutions","followers_url":"https://api.github.com/users/web2solutions/followers","following_url":"https://api.github.com/users/web2solutions/following{/other_user}","gists_url":"https://api.github.com/users/web2solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/web2solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/web2solutions/subscriptions","organizations_url":"https://api.github.com/users/web2solutions/orgs","repos_url":"https://api.github.com/users/web2solutions/repos","events_url":"https://api.github.com/users/web2solutions/events{/privacy}","received_events_url":"https://api.github.com/users/web2solutions/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"860e456118b910b6fde33d56ab928ef8031bc81f","created_at":"2015-09-30T21:17:40Z","updated_at":"2015-09-30T21:17:40Z","body":"> Give your solution, it seems like the name of _lookupOrCreateExpensiveResourceById is now misleading. What if I want to share the expensive resource if I can?\r\n\r\n> Assume:\r\n\r\n    function assert(condition, message) {\r\n        if (!condition) {\r\n            throw message || \"Assertion failed\";\r\n        }\r\n    }\r\n\r\n\r\n> Now consider:\r\n\r\n   var rsrc1 = resource(42);\r\n   var rsrc2 = resource(42);\r\n   assert(rsrc1.getExpensiveResource() === rsrc2.getExpensiveResource(), \"unnecessarily reallocating resource(42)\");\r\n\r\nGet fails ... but, if you check the value property of both diferent ExpensiveResouces, it will be equal\r\n\r\n    QUnit.test( \"compare expensiveResources with same id\", function( assert ) {\r\n    \t  assert.ok( resource.getExpensiveResource().value === resource2.getExpensiveResource().value, \"equal\" );\r\n   \t});\r\n\r\nThe point for me, is not here. How I told before, we could have a global var for storing multiple different resources, this could be a functional use for the _all_ids collection, but in a very different implementation that you made on the original code\r\n"}}