Edit report at https://bugs.php.net/bug.php?id=40296&edit=1
ID: 40296 Comment by: email at philsturgeon dot co dot uk Reported by: mail at tobyinkster dot co dot uk Summary: "unless" control structure Status: Wont fix Type: Feature/Change Request Package: *General Issues Operating System: All PHP Version: 5.2.0 Block user comment: N Private report: N New Comment: It looks like this conversation dried up after the rather out-of-context confusion over unless somehow meaning "more". Can we move past that please, as it's a ridiculous non-issue. Previous Comments: ------------------------------------------------------------------------ [2012-07-30 15:09:00] email at philsturgeon dot co dot uk Rasmus: toby was not suggesting that "uniqid" is the opposite of "iqid", he is saying that you can have "un" at the start of a function or keyword without it automatically flipping the meaning of the next few letters and confusing people - as you suggested in your comment yesterday. In neither situation does "un" switch the meaning of the following letters, so if it is ok for one function/keyword it should be ok for another, right? I don't want to argue, I just want to make sure people are clear. I would hate to see this conversation derailed by confusion or people loudly agreeing. ------------------------------------------------------------------------ [2012-07-30 15:00:31] ras...@php.net Now you are just being silly. "uniqid" is "unique id" from the latin root "uni" meaning one or singular. Makes perfect sense . It isn't "un" anything. ------------------------------------------------------------------------ [2012-07-30 13:19:47] mail at tobyinkster dot co dot uk FWIW, while Perl does allow unless (foo) { bar } else { baz } I've never seen it in the wild. I've only ever seen unless used without any trailing else conditions. (And although Perl syntax allows else following unless, it explicitly disallows elsif following unless.) I'd be perfectly happy for PHP to forbid both elseif and else after unless. > It also isn't a very common feature in other languages Latin had "nisi". Modern languages derived from Latin are all the poorer for having lost this concept. > It is an odd word that essentially means not-if even though > it logically should be equivalent to "more" as in the > opposite of "more" would be "less" and sticking "un" in > front of it suddenly completely changes the meaning entirely. By that logic, uniqid() should return the opposite of the iqid() function. ------------------------------------------------------------------------ [2012-07-29 21:42:28] email at philsturgeon dot co dot uk In regards to double negatives, I agree. If I see a developer do this unless a != 7 then I would block their PR and instantly go and have a talk with them about writing sane code. As for else it really shouldn't be used that much but it should be possible. unless (foo === 'bar') { // do something } else { // do something else } Is that really a confusion? Unlesselse might become a dog though, not sure about that: unless (foo === 'bar') { // do something } unlesselse (foo === 'baz') { // do something } else { // do something else } At that point you'd just want to be using a switch, but that is the same for if's. As I said unless should not really use an else, otherwise you'd be better off just using an if and swapping it around, but having it doesn't hurt. ------------------------------------------------------------------------ [2012-07-29 21:35:45] kinghfb+php at gmail dot com The structure adds sugar without necessarily breaking anything (with the exception of existing unless() functions, as Rasmus mentioned). I really don't think the double-negatives argument works here, as we're already doing that with 'if', meaning that the readability is quite low in some cases. My only concern is that the structure seems to be more easily convoluted than 'if', potentially leading to nightmarish comprehension tasks. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=40296 -- Edit this bug report at https://bugs.php.net/bug.php?id=40296&edit=1