{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2438","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2438/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2438/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2438/events","html_url":"https://github.com/fish-shell/fish-shell/issues/2438","id":108620781,"number":2438,"title":"Cartesian product is weird with zero elements","user":{"login":"alphapapa","id":601365,"avatar_url":"https://avatars.githubusercontent.com/u/601365?v=3","gravatar_id":"","url":"https://api.github.com/users/alphapapa","html_url":"https://github.com/alphapapa","followers_url":"https://api.github.com/users/alphapapa/followers","following_url":"https://api.github.com/users/alphapapa/following{/other_user}","gists_url":"https://api.github.com/users/alphapapa/gists{/gist_id}","starred_url":"https://api.github.com/users/alphapapa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphapapa/subscriptions","organizations_url":"https://api.github.com/users/alphapapa/orgs","repos_url":"https://api.github.com/users/alphapapa/repos","events_url":"https://api.github.com/users/alphapapa/events{/privacy}","received_events_url":"https://api.github.com/users/alphapapa/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/8","html_url":"https://github.com/fish-shell/fish-shell/milestones/fish-tank","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/8/labels","id":343670,"number":8,"title":"fish-tank","description":"Issues (typically enhancement requests) that are worth considering but there's no consensus on, or where the path forward is not clear.","creator":{"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},"open_issues":51,"closed_issues":22,"state":"open","created_at":"2013-05-28T21:04:35Z","updated_at":"2015-10-18T13:40:53Z","due_on":null,"closed_at":null},"comments":36,"created_at":"2015-09-28T09:31:49Z","updated_at":"2015-10-21T05:03:34Z","closed_at":null,"body":"```fish\r\n$ set foo fizz\r\n$ set bar buzz\r\n$ echo {$foo}{$bar}\r\nfizzbuzz\r\n```\r\nHowever:\r\n```fish\r\n$ set bar buzz\r\n$ echo {$foo}{$bar}\r\n$\r\n```\r\nAnd:\r\n```fish\r\n$ set foo \"\"\r\n$ set bar buzz\r\n$ echo {$foo}{$bar}\r\nbuzz\r\n```\r\nShouldn't the second example output `buzz`?"},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/149783634","html_url":"https://github.com/fish-shell/fish-shell/issues/2438#issuecomment-149783634","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2438","id":149783634,"user":{"login":"oconnore","id":1103746,"avatar_url":"https://avatars.githubusercontent.com/u/1103746?v=3","gravatar_id":"","url":"https://api.github.com/users/oconnore","html_url":"https://github.com/oconnore","followers_url":"https://api.github.com/users/oconnore/followers","following_url":"https://api.github.com/users/oconnore/following{/other_user}","gists_url":"https://api.github.com/users/oconnore/gists{/gist_id}","starred_url":"https://api.github.com/users/oconnore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oconnore/subscriptions","organizations_url":"https://api.github.com/users/oconnore/orgs","repos_url":"https://api.github.com/users/oconnore/repos","events_url":"https://api.github.com/users/oconnore/events{/privacy}","received_events_url":"https://api.github.com/users/oconnore/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T05:03:34Z","updated_at":"2015-10-21T05:03:34Z","body":"@alphapapa I think when @faho asked for specific suggestions, they were talking about the documentation changes. I think you're right that people who install fish expect it to be like all other shells. The key isn't to actually do that, but to clearly document the ways that fish *isn't* exactly like all other shells. That way no one is confused, and people can be productive in fish.\r\n\r\nAs for the issue: assuming that the documentation is fixed, so that everyone understand how this works, what's wrong with just quoting your variables? `echo \"something$list\"` is just two additional characters. No big deal once you've learned the trick.\r\n\r\n> It's possible we could expand this or clarify it a bit more - feel free to make suggestions or even pull requests!\r\n\r\nHere are some specific ideas:\r\n\r\n* Adding this issue to \"Common issues with fish\" \r\n* In documentation, add all the sub headings to the left nav. For example, the section on brace expansion doesn't have an entry, so if you're just clicking around, you'll never find it.\r\n* Adding a section \"Cartesian Expansion\" just before all the various \"* Expansions\" sections.\r\n* Add a link to \"Cartesian Expansion\" in the design document \"Law of orthogonality\", and discuss how  cartesian expansion is applied throughout the shell. \r\n\r\nHere's a rough start:\r\n\r\n> # Shell Variables\r\n>\r\n> Shell variables are names that correspond to a list of zero or more strings of text. This is different from many other shells, where variables contain a single string of text. These variables can be created, deleted and modified by the user. They are inserted into user commands by **Variable Expansion**, and are subject to **Cartesian Expansion**.\r\n>\r\n> Variables may optionally be \"exported\", so that a copy of the variable is available to any subprocesses the shell creates. An exported variable is referred to as an \"environment variable\".\r\n>\r\n> To set a variable value, use the set command.\r\n>\r\n> Example:\r\n>\r\n> To set the variable smurf_color to the value blue, use the command set smurf_color blue.\r\n>\r\n> After a variable has been set, you can use the value of a variable in the shell through variable expansion.\r\n>\r\n> Example:\r\n>\r\n> To use the value of the variable smurf, write $ (dollar symbol) followed by the name of the variable, like echo Smurfs are usually $smurf_color, which would print the result 'Smurfs are usually blue'.\r\n>\r\n> # Cartesian Expansion\r\n>\r\n> Fish will replace certain parts of a command with modified text according to some rules. This is similar to aliases, macros, or variable expansion in other shells and languages. There are 5 different ways that fish expands text:\r\n>\r\n> 1. Command expansion: `(grep \"fish\" ~/file)` => line1 fish\\nline2 fish\r\n> 1. Variable expansion: `set var Hi!; echo $var` => Hi!\r\n> 1. Bracket expansion: `echo {diary,groceries,resume}.txt` => diary.txt groceries.txt resume.txt\r\n> 1. PID expansion `%firefox` => 45932\r\n> 1. Wildcard expansion `**/homework.txt` => my/dog/lost/my/homework.txt\r\n>\r\n> These rules are applied in order. The resulting variables, each containing zero or more strings, are combined such that the cartesian product (the set of all possible combinations) is inserted into the command. \r\n>\r\n> Example:\r\n>\r\n> > set var once twice thrice\r\n> > echo Hello_$var\r\n> Hello_once Hello_twice Hello_thrice\r\n>\r\n> Example:\r\n>\r\n> > set one A B C\r\n> > set two 1 2 3\r\n> > echo $one$two\r\n> A1 A2 A3 B1 B2 B3 C1 C2 C3\r\n>\r\n> This sort of expansion is often the desired behavior, especially when working with file paths (as shell programs often are), program output, and so on. When simpler variable expansion is desired, use \"double quotes\" to directly expand a variable.\r\n>\r\n> Example:\r\n>\r\n> > set one A B C\r\n> > set two D\r\n> > echo \"$one\"two\r\n> A B CD\r\n> > echo $onetwo\r\n> AD BD CD"}}