{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/emacs-lisp-style-guide/issues/50","repository_url":"https://api.github.com/repos/bbatsov/emacs-lisp-style-guide","labels_url":"https://api.github.com/repos/bbatsov/emacs-lisp-style-guide/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/emacs-lisp-style-guide/issues/50/comments","events_url":"https://api.github.com/repos/bbatsov/emacs-lisp-style-guide/issues/50/events","html_url":"https://github.com/bbatsov/emacs-lisp-style-guide/issues/50","id":354718411,"node_id":"MDU6SXNzdWUzNTQ3MTg0MTE=","number":50,"title":"Prefer `nil` for empty lists over `()` or `'()`","user":{"login":"Fuco1","id":2664959,"node_id":"MDQ6VXNlcjI2NjQ5NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/2664959?v=4","gravatar_id":"","url":"https://api.github.com/users/Fuco1","html_url":"https://github.com/Fuco1","followers_url":"https://api.github.com/users/Fuco1/followers","following_url":"https://api.github.com/users/Fuco1/following{/other_user}","gists_url":"https://api.github.com/users/Fuco1/gists{/gist_id}","starred_url":"https://api.github.com/users/Fuco1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fuco1/subscriptions","organizations_url":"https://api.github.com/users/Fuco1/orgs","repos_url":"https://api.github.com/users/Fuco1/repos","events_url":"https://api.github.com/users/Fuco1/events{/privacy}","received_events_url":"https://api.github.com/users/Fuco1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-28T12:55:07Z","updated_at":"2018-08-28T16:03:50Z","closed_at":null,"author_association":"COLLABORATOR","body":"There are essentially 5 ways to \"initialize\" a list\r\n\r\n```elisp\r\n(let (results)\r\n  (--each ... (push x results)))\r\n\r\n(let ((results))\r\n  (--each ... (push x results)))\r\n\r\n(let ((results nil))\r\n  (--each ... (push x results)))\r\n\r\n(let ((results ()))\r\n  (--each ... (push x results)))\r\n\r\n(let ((results '()))\r\n  (--each ... (push x results)))\r\n```\r\n\r\nPersonally I use 2 and 3 and prefer 2 if there are multiple bindings at the same time\r\n\r\n```\r\n(let ((x 1)\r\n      (y 2)\r\n      (results)\r\n      (z 3))\r\n  (--each ... (push x results)))\r\n```\r\n\r\nHaving it wrapped in the parens sort of signifies to me it's a list.  A nil there wouldn't hurt though, I'm just lazy. \r\n\r\nI was hoping there would be some way to distinguish `()` and `nil` for example for the purpose of analysis but they both appear as `nil` to the reader, so meh."},"comment":{"url":"https://api.github.com/repos/bbatsov/emacs-lisp-style-guide/issues/comments/416643977","html_url":"https://github.com/bbatsov/emacs-lisp-style-guide/issues/50#issuecomment-416643977","issue_url":"https://api.github.com/repos/bbatsov/emacs-lisp-style-guide/issues/50","id":416643977,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjY0Mzk3Nw==","user":{"login":"bbatsov","id":103882,"node_id":"MDQ6VXNlcjEwMzg4Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/103882?v=4","gravatar_id":"","url":"https://api.github.com/users/bbatsov","html_url":"https://github.com/bbatsov","followers_url":"https://api.github.com/users/bbatsov/followers","following_url":"https://api.github.com/users/bbatsov/following{/other_user}","gists_url":"https://api.github.com/users/bbatsov/gists{/gist_id}","starred_url":"https://api.github.com/users/bbatsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbatsov/subscriptions","organizations_url":"https://api.github.com/users/bbatsov/orgs","repos_url":"https://api.github.com/users/bbatsov/repos","events_url":"https://api.github.com/users/bbatsov/events{/privacy}","received_events_url":"https://api.github.com/users/bbatsov/received_events","type":"User","site_admin":false},"created_at":"2018-08-28T16:03:50Z","updated_at":"2018-08-28T16:03:50Z","author_association":"OWNER","body":"I generally go with option 2, as then it's easy to add more non-empty elements to the bindings, but I agree that 3 & 4 definitely read better. I'm fine with suggesting the use of `nil`, although I don't think we should discourage `()`. "}}
{"actor":{"display_login":"bbatsov"}}