{"action":"created","issue":{"url":"https://api.github.com/repos/google/jsonnet/issues/220","repository_url":"https://api.github.com/repos/google/jsonnet","labels_url":"https://api.github.com/repos/google/jsonnet/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/google/jsonnet/issues/220/comments","events_url":"https://api.github.com/repos/google/jsonnet/issues/220/events","html_url":"https://github.com/google/jsonnet/issues/220","id":166897710,"number":220,"title":"Dictionaries with no sense of self","user":{"login":"copumpkin","id":2623,"avatar_url":"https://avatars.githubusercontent.com/u/2623?v=3","gravatar_id":"","url":"https://api.github.com/users/copumpkin","html_url":"https://github.com/copumpkin","followers_url":"https://api.github.com/users/copumpkin/followers","following_url":"https://api.github.com/users/copumpkin/following{/other_user}","gists_url":"https://api.github.com/users/copumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/copumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copumpkin/subscriptions","organizations_url":"https://api.github.com/users/copumpkin/orgs","repos_url":"https://api.github.com/users/copumpkin/repos","events_url":"https://api.github.com/users/copumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/copumpkin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-21T19:23:22Z","updated_at":"2016-07-21T19:34:11Z","closed_at":null,"body":"I find that most of the time I'm writing jsonnet, having an object bring a magic `self` into scope is a bit of a pain. I usually end up having to define a `local realSelf = self` in the outer scope to retain the `self` that I actually wanted.\r\n\r\nCan we have raw dictionaries with no magic `self` in scope for those times we just want to operate on a pure datastructure?\r\n\r\nThis is _almost_ the opposite of the `rec` keyword in Nix. For context, `rec` brings a dictionary's keys into scope within that dictionary, and the default is to have no access to the equivalent of `self`. I'm not proposing changing the default at this stage, but it would be nice to have a way to opt out.\r\n\r\ncc @roconnor, since whenever I mention Nix @sparkprime cc's him anyway 😄 "},"comment":{"url":"https://api.github.com/repos/google/jsonnet/issues/comments/234359579","html_url":"https://github.com/google/jsonnet/issues/220#issuecomment-234359579","issue_url":"https://api.github.com/repos/google/jsonnet/issues/220","id":234359579,"user":{"login":"sparkprime","id":168158,"avatar_url":"https://avatars.githubusercontent.com/u/168158?v=3","gravatar_id":"","url":"https://api.github.com/users/sparkprime","html_url":"https://github.com/sparkprime","followers_url":"https://api.github.com/users/sparkprime/followers","following_url":"https://api.github.com/users/sparkprime/following{/other_user}","gists_url":"https://api.github.com/users/sparkprime/gists{/gist_id}","starred_url":"https://api.github.com/users/sparkprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparkprime/subscriptions","organizations_url":"https://api.github.com/users/sparkprime/orgs","repos_url":"https://api.github.com/users/sparkprime/repos","events_url":"https://api.github.com/users/sparkprime/events{/privacy}","received_events_url":"https://api.github.com/users/sparkprime/received_events","type":"User","site_admin":false},"created_at":"2016-07-21T19:34:11Z","updated_at":"2016-07-21T19:34:11Z","body":"I usually give them descriptive names so instead of `local realSelf = self` I use `local service = self` or whatever it is.\r\n\r\nTo be clear, what you're proposing is a syntax sugar:\r\n\r\n`{ inner: {{ x: self.y, y: 3 }}, y: 10 }`\r\n\r\ndesugared via this rule:\r\n`{{ [f]: e, ... }} -> local fresh = self; { [f]: e[fresh / self] }`\r\n\r\nto\r\n\r\n`{ inner: local fresh = self; { x: fresh.y, y: 3 }, y: 10 }`\r\n\r\nwhich would manifest as:\r\n\r\n`{ \"inner\": { \"x\": 10, \"y\": 3 }, \"y\": 3 }`"}}
{"actor":{"display_login":"sparkprime"}}