{"action":"created","issue":{"url":"https://api.github.com/repos/elves/elvish/issues/599","repository_url":"https://api.github.com/repos/elves/elvish","labels_url":"https://api.github.com/repos/elves/elvish/issues/599/labels{/name}","comments_url":"https://api.github.com/repos/elves/elvish/issues/599/comments","events_url":"https://api.github.com/repos/elves/elvish/issues/599/events","html_url":"https://github.com/elves/elvish/issues/599","id":296682633,"number":599,"title":"Feature proposal: allow options when loading modules","user":{"login":"zzamboni","id":32876,"avatar_url":"https://avatars1.githubusercontent.com/u/32876?v=4","gravatar_id":"","url":"https://api.github.com/users/zzamboni","html_url":"https://github.com/zzamboni","followers_url":"https://api.github.com/users/zzamboni/followers","following_url":"https://api.github.com/users/zzamboni/following{/other_user}","gists_url":"https://api.github.com/users/zzamboni/gists{/gist_id}","starred_url":"https://api.github.com/users/zzamboni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zzamboni/subscriptions","organizations_url":"https://api.github.com/users/zzamboni/orgs","repos_url":"https://api.github.com/users/zzamboni/repos","events_url":"https://api.github.com/users/zzamboni/events{/privacy}","received_events_url":"https://api.github.com/users/zzamboni/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-13T10:17:49Z","updated_at":"2018-02-13T14:46:23Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"It would be nice to have a way to pass data when loading a module with the `use` command. To keep in line with existing conventions, it could be passed as options, for example:\r\n```\r\nuse &foo=bar &baz=boo module\r\n```\r\nI think the best way to handle this would be to set `module:foo=bar` and `module:baz=boo` before executing the module code. This would be a good way to set default values for module variables which can be used at load time.\r\n\r\nAlternatively, the options could be stored in a special map that can be accessed by the module."},"comment":{"url":"https://api.github.com/repos/elves/elvish/issues/comments/365287849","html_url":"https://github.com/elves/elvish/issues/599#issuecomment-365287849","issue_url":"https://api.github.com/repos/elves/elvish/issues/599","id":365287849,"user":{"login":"hanche","id":518961,"avatar_url":"https://avatars3.githubusercontent.com/u/518961?v=4","gravatar_id":"","url":"https://api.github.com/users/hanche","html_url":"https://github.com/hanche","followers_url":"https://api.github.com/users/hanche/followers","following_url":"https://api.github.com/users/hanche/following{/other_user}","gists_url":"https://api.github.com/users/hanche/gists{/gist_id}","starred_url":"https://api.github.com/users/hanche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanche/subscriptions","organizations_url":"https://api.github.com/users/hanche/orgs","repos_url":"https://api.github.com/users/hanche/repos","events_url":"https://api.github.com/users/hanche/events{/privacy}","received_events_url":"https://api.github.com/users/hanche/received_events","type":"User","site_admin":false},"created_at":"2018-02-13T14:46:23Z","updated_at":"2018-02-13T14:46:23Z","author_association":"NONE","body":"@zzamboni What you describe is what I expected. However, assigning to a module variable is at least very explicit, and has the same effect always. But it is disconcerting to not know whether the options you give to the `use` call will be honoured or not – depending on whether the module was already loaded or not. I think the potential for confusion is less with my suggestion."}}
{"actor":{"display_login":"hanche"}}