{"action":"created","issue":{"url":"https://api.github.com/repos/perl6/specs/issues/87","labels_url":"https://api.github.com/repos/perl6/specs/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/perl6/specs/issues/87/comments","events_url":"https://api.github.com/repos/perl6/specs/issues/87/events","html_url":"https://github.com/perl6/specs/issues/87","id":60633172,"number":87,"title":"\"0\" in boolean context evaluates to False","user":{"login":"grondilu","id":293068,"avatar_url":"https://avatars.githubusercontent.com/u/293068?v=3","gravatar_id":"","url":"https://api.github.com/users/grondilu","html_url":"https://github.com/grondilu","followers_url":"https://api.github.com/users/grondilu/followers","following_url":"https://api.github.com/users/grondilu/following{/other_user}","gists_url":"https://api.github.com/users/grondilu/gists{/gist_id}","starred_url":"https://api.github.com/users/grondilu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grondilu/subscriptions","organizations_url":"https://api.github.com/users/grondilu/orgs","repos_url":"https://api.github.com/users/grondilu/repos","events_url":"https://api.github.com/users/grondilu/events{/privacy}","received_events_url":"https://api.github.com/users/grondilu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-11T09:48:30Z","updated_at":"2015-03-11T16:30:54Z","closed_at":null,"body":"While looking at http://rosettacode.org/wiki/Temperature_conversion#Perl_6, it occurred to me that it's a bit unfortunate that the string \"0\" (and not the integer) evaluates to False.  It's not much consistent either, considering that other strings of null numerical value (e.g.  \"-0\" or \"0+0i\") evaluate to True.\r\n\r\nIf \"0\" was evaluating to True, the loop could be written:\r\n\r\n    while my $temperature = prompt \"Temperature: \" {\r\n        ...\r\n    }\r\n\r\nwith no risk of ending the program prematurely if the user enters \"0\".\r\n\r\nSee also IRC backlog of this day."},"comment":{"url":"https://api.github.com/repos/perl6/specs/issues/comments/78299945","html_url":"https://github.com/perl6/specs/issues/87#issuecomment-78299945","issue_url":"https://api.github.com/repos/perl6/specs/issues/87","id":78299945,"user":{"login":"polettix","id":114540,"avatar_url":"https://avatars.githubusercontent.com/u/114540?v=3","gravatar_id":"","url":"https://api.github.com/users/polettix","html_url":"https://github.com/polettix","followers_url":"https://api.github.com/users/polettix/followers","following_url":"https://api.github.com/users/polettix/following{/other_user}","gists_url":"https://api.github.com/users/polettix/gists{/gist_id}","starred_url":"https://api.github.com/users/polettix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polettix/subscriptions","organizations_url":"https://api.github.com/users/polettix/orgs","repos_url":"https://api.github.com/users/polettix/repos","events_url":"https://api.github.com/users/polettix/events{/privacy}","received_events_url":"https://api.github.com/users/polettix/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T16:30:54Z","updated_at":"2015-03-11T16:30:54Z","body":"I daresay it's what I would expect according to the principle of least\nsurprise as a Perl5 hacker.\n\nIIRC, in Perl5 there is \"0 but true\" that evaluates to a true value in\nboolean context (or \"0E0\" for what that matters), but it becomes the\ninteger 0 when evaluated as a number (I'm completely ignorant about Perl6\nnumber system).\n\nCiao,\n\n    Flavio.\n\n\n2015-03-11 10:48 GMT+01:00 grondilu <notifications@github.com>:\n\n> While looking at http://rosettacode.org/wiki/Temperature_conversion#Perl_6,\n> it occurred to me that it's a bit unfortunate that the string \"0\" (and not\n> the integer) evaluates to False. It's not much consistent either,\n> considering that other strings of null numerical value (e.g. \"-0\" or\n> \"0+0i\") evaluate to True.\n>\n> See also IRC backlog of this day.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/perl6/specs/issues/87>.\n>\n"}}