{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/fetch-client/issues/11","labels_url":"https://api.github.com/repos/aurelia/fetch-client/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/fetch-client/issues/11/comments","events_url":"https://api.github.com/repos/aurelia/fetch-client/issues/11/events","html_url":"https://github.com/aurelia/fetch-client/pull/11","id":101917885,"number":11,"title":"[WIP] Make the API immutable","user":{"login":"Alxandr","id":112334,"avatar_url":"https://avatars.githubusercontent.com/u/112334?v=3","gravatar_id":"","url":"https://api.github.com/users/Alxandr","html_url":"https://github.com/Alxandr","followers_url":"https://api.github.com/users/Alxandr/followers","following_url":"https://api.github.com/users/Alxandr/following{/other_user}","gists_url":"https://api.github.com/users/Alxandr/gists{/gist_id}","starred_url":"https://api.github.com/users/Alxandr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alxandr/subscriptions","organizations_url":"https://api.github.com/users/Alxandr/orgs","repos_url":"https://api.github.com/users/Alxandr/repos","events_url":"https://api.github.com/users/Alxandr/events{/privacy}","received_events_url":"https://api.github.com/users/Alxandr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-08-19T15:17:26Z","updated_at":"2015-08-24T15:50:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/aurelia/fetch-client/pulls/11","html_url":"https://github.com/aurelia/fetch-client/pull/11","diff_url":"https://github.com/aurelia/fetch-client/pull/11.diff","patch_url":"https://github.com/aurelia/fetch-client/pull/11.patch"},"body":"```js\r\nvar conf = new Conf();\r\nvar withBaseUrl = conf.withBaseUrl(‘foo’);\r\nvar withOtherBaseUrl = conf.withBaseUrl(‘other’);\r\n\r\nconsole.log(withBaseUrl.baseUrl); // => \"other\", WTF?\r\n```\r\n\r\nNote, this is a rudimentary suggestion. It's not been tested (I think maybe the order of my `...this._options` is wrong), but I'm on a borrowed PC which doesn't have NPM or node (and my PC is away for service :-/), so I've just changed this in-browser.\r\n\r\nThe main point is to show how I think the API should look. For most people this will not affect anything at all, but it allows you to do stuff like this:\r\n\r\n```js\r\nvar serverConfig = new Config().withBaseUrl('blah');\r\nvar loginConfig = serverConfig.withDefaults({'some-secret': 'some-value'});\r\n```"},"comment":{"url":"https://api.github.com/repos/aurelia/fetch-client/issues/comments/134257771","html_url":"https://github.com/aurelia/fetch-client/pull/11#issuecomment-134257771","issue_url":"https://api.github.com/repos/aurelia/fetch-client/issues/11","id":134257771,"user":{"login":"bryanrsmith","id":186704,"avatar_url":"https://avatars.githubusercontent.com/u/186704?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanrsmith","html_url":"https://github.com/bryanrsmith","followers_url":"https://api.github.com/users/bryanrsmith/followers","following_url":"https://api.github.com/users/bryanrsmith/following{/other_user}","gists_url":"https://api.github.com/users/bryanrsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanrsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanrsmith/subscriptions","organizations_url":"https://api.github.com/users/bryanrsmith/orgs","repos_url":"https://api.github.com/users/bryanrsmith/repos","events_url":"https://api.github.com/users/bryanrsmith/events{/privacy}","received_events_url":"https://api.github.com/users/bryanrsmith/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T15:50:30Z","updated_at":"2015-08-24T15:50:30Z","body":"Are we talking about supporting both mutable and immutable APIs? I really don't want to do that. It will make configuration code inconsistent and confuse people. Plus we'd still have to break APIs like the router configuration because it uses property setters that can't support immutability as-is. \r\n\r\nI do like the proposed immutable API, but I think it could be a painful break and I'm not sure the benefit is worth it for configuration objects. I certainly wouldn't object to dropping use of `with` to make the result of the call clearer."}}