Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70098 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14530 invoked from network); 11 Nov 2013 18:56:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2013 18:56:57 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.171 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.171 mail-we0-f171.google.com Received: from [74.125.82.171] ([74.125.82.171:44553] helo=mail-we0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/40-11065-87821825 for ; Mon, 11 Nov 2013 13:56:57 -0500 Received: by mail-we0-f171.google.com with SMTP id t61so1671294wes.30 for ; Mon, 11 Nov 2013 10:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=cqzmm8BF/feMnauTpKmh+JNEF3aHnZNmXBaKVPSZVls=; b=ozAR6Ux0N+w3Htr0atnqCfAszv+nC08O8ApfGM3UdHZ9rdtr6qnOHmnMaMi4uHfOnQ jhqt8G4qVYvXe7Wtr8ObORmd9DGLCPDUoL+cK3YO2gWw02n0EY+Wzr7PolpTQ/B4JFXs JknFYLx/Iu1bR46ABD0kna2EfqbN5VG/wkXS0AcVZcDr1o08JFmUcdRJpdpYfy96c1tf tE88gmU2qFpb0ys69gZ+wZeQJegb6dQ+sEEtxUgq4v4njqa1gx6khG1VQwBMTYy9CIAZ SLdxE7x2LYMHWXBpCUiKSnOHIR9fkj6YGMQ2v+Hsk7D93/aRdhkdJaf/DlKwr2WTq1Og KVXg== X-Received: by 10.180.79.163 with SMTP id k3mr10852472wix.34.1384196214357; Mon, 11 Nov 2013 10:56:54 -0800 (PST) Received: from [192.168.0.146] ([62.189.198.114]) by mx.google.com with ESMTPSA id hv5sm36839783wib.2.2013.11.11.10.56.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Nov 2013 10:56:53 -0800 (PST) Message-ID: <52812873.70406@gmail.com> Date: Mon, 11 Nov 2013 18:56:51 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: internals@lists.php.net References: <527DF228.1080108@sugarcrm.com> <416659913.20131110035553@cypressintegrated.com> <127298508.20131110042057@cypressintegrated.com> <97776909.20131110045342@cypressintegrated.com> <527FDE61.70102@gmail.com> <346085145.20131110145938@cypressintegrated.com> In-Reply-To: <346085145.20131110145938@cypressintegrated.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Comparison and conversion inconsistency - need more info From: rowan.collins@gmail.com (Rowan Collins) Sanford Whiteman wrote (on 10/11/2013): >> I didn't immediately spot it, but the word "comparable" next to each >> argument in the Parameters section is linked to the comparison operators >> page. It mgiht be an idea to add it to the See Also section as well, to >> make it more visible. > Don't see how this has any more of a visibility problem than `mixed` > type params for other functions. Well, "mixed" is a pseudo-type used consistently throughout the manual and linked to an explanation of the term here: http://php.net/manual/en/language.pseudo-types.php The fact that a particular value has to be "comparable", on the other hand, doesn't really tell you how the different parameters interact, so the link has poor "information scent" - I'd probably click there if my values were being rejected, but not if certain *combinations* were behaving "oddly". The reason I suggested a "See also" is that it's unobtrusive, but can include clear text as to why you might want to look at it. Actually, now I look, most of the other text specifically talks only about numeric (e.g. the "Return Values" section: "min() returns the numerically lowest of the parameter values" which is just plain wrong) or alphanumeric (in the "Note:" within the "Description" section) values. This could easily reinforce the kind of mistake made here of thinking that everything is cast to int (or possibly string) before comparison. > IMO, it's a nice convenience that the hyperlink is there, but not even > necessary. min() should be assumed to be sort() and > unshift(). Sort --> comparison --> comparison rules apply. That's certainly an intuitive explanation, but it's by no means the only way of implementing or imagining the underlying algorithm. It would be one way of making clear what happens though: "This function is equivalent to sorting the items based on the [link]standard type comparisons[/link] and returning the first item." You don't have to think the current documentation is awful to find ways of improving it. Regards, -- Rowan Collins [IMSoP]