{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/1908","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/1908/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/1908/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/1908/events","html_url":"https://github.com/fish-shell/fish-shell/issues/1908","id":54938535,"number":1908,"title":"resourcing config file doesn't work as function. why?","user":{"login":"danielb2","id":26678,"avatar_url":"https://avatars.githubusercontent.com/u/26678?v=3","gravatar_id":"","url":"https://api.github.com/users/danielb2","html_url":"https://github.com/danielb2","followers_url":"https://api.github.com/users/danielb2/followers","following_url":"https://api.github.com/users/danielb2/following{/other_user}","gists_url":"https://api.github.com/users/danielb2/gists{/gist_id}","starred_url":"https://api.github.com/users/danielb2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielb2/subscriptions","organizations_url":"https://api.github.com/users/danielb2/orgs","repos_url":"https://api.github.com/users/danielb2/repos","events_url":"https://api.github.com/users/danielb2/events{/privacy}","received_events_url":"https://api.github.com/users/danielb2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/9","html_url":"https://github.com/fish-shell/fish-shell/milestones/fish%202.2.0","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/9/labels","id":462599,"number":9,"title":"fish 2.2.0","description":"the next minor release of fish (2.2)","creator":{"login":"zanchey","id":520741,"avatar_url":"https://avatars.githubusercontent.com/u/520741?v=3","gravatar_id":"","url":"https://api.github.com/users/zanchey","html_url":"https://github.com/zanchey","followers_url":"https://api.github.com/users/zanchey/followers","following_url":"https://api.github.com/users/zanchey/following{/other_user}","gists_url":"https://api.github.com/users/zanchey/gists{/gist_id}","starred_url":"https://api.github.com/users/zanchey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanchey/subscriptions","organizations_url":"https://api.github.com/users/zanchey/orgs","repos_url":"https://api.github.com/users/zanchey/repos","events_url":"https://api.github.com/users/zanchey/events{/privacy}","received_events_url":"https://api.github.com/users/zanchey/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":330,"state":"open","created_at":"2013-10-23T13:44:11Z","updated_at":"2015-05-05T05:34:43Z","due_on":"2015-05-11T16:00:00Z","closed_at":null},"comments":15,"created_at":"2015-01-20T20:57:12Z","updated_at":"2015-05-05T19:03:57Z","closed_at":null,"body":"``` bash\r\n$ type resource\r\nresource is a function with definition\r\nfunction resource\r\n        source ~/.config/fish/config.fish\r\nend\r\n```\r\n\r\nwhy doesn't this actually work to re-source the file again?\r\n\r\nI edit the config.fish file, and add a `set -x BLAH foo` for instance, but running `resource` will not honor it, and I have to run `source ~/.config/fish/config.fish` manually"},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/99183417","html_url":"https://github.com/fish-shell/fish-shell/issues/1908#issuecomment-99183417","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/1908","id":99183417,"user":{"login":"ridiculousfish","id":920838,"avatar_url":"https://avatars.githubusercontent.com/u/920838?v=3","gravatar_id":"","url":"https://api.github.com/users/ridiculousfish","html_url":"https://github.com/ridiculousfish","followers_url":"https://api.github.com/users/ridiculousfish/followers","following_url":"https://api.github.com/users/ridiculousfish/following{/other_user}","gists_url":"https://api.github.com/users/ridiculousfish/gists{/gist_id}","starred_url":"https://api.github.com/users/ridiculousfish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ridiculousfish/subscriptions","organizations_url":"https://api.github.com/users/ridiculousfish/orgs","repos_url":"https://api.github.com/users/ridiculousfish/repos","events_url":"https://api.github.com/users/ridiculousfish/events{/privacy}","received_events_url":"https://api.github.com/users/ridiculousfish/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T19:03:57Z","updated_at":"2015-05-05T19:03:57Z","body":"@geoff-codes Thanks for your considered write-up. I realized what I wrote up before is incorrect.\r\n\r\nLet me respond:\r\n\r\n> As I understand it, a \"top-level local scope\" could exist prior to this change, but only when explicitly declared as locally scoped\r\n\r\nRight. If you ran `set -l var val` at top level, a local scope would be created for the extent of that command, and destroyed at the end. So you had this:\r\n\r\n    > set -l abc 1 2 3\r\n    > count $abc\r\n    0\r\n\r\nwhich is sort of silly.\r\n\r\n> Now, the top level local scope persists throughout the session, and this is the scope of unscoped variable declarations, if they're not within a block or function\r\n\r\nNo, this is not the new behavior. The new top level scope is like the scope established by begin/end, not like a function. The behavior of unscoped variables at the top level is the same as before: they become globals.\r\n\r\nThe change is that, in my example above, `abc` would go into the new perma-local scope, so it would be visible to other commands run at the same scope, like the following `count`. But it would not be visible to called functions (nor was it previously).\r\n\r\n> If no function is executing, the variable will be local to top level of the session. Note that this is different from using the -g or --global flag, as these variables will not be accessible to functions (as global variables are)\r\n\r\nNo, unscoped variables at the top level really do become globals, as before.\r\n\r\n> So I would argue that it would make a lot more sense to create the \"top level local scope\" before config.fish is sourced on startup\r\n\r\nAgreed, and in fact this is what it does; I just got it wrong.\r\n\r\nLet me go correct my comment above and then I'll take a whack at the relnote description."}}