Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84759 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99144 invoked from network); 14 Mar 2015 04:32:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2015 04:32:38 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.49 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.218.49 mail-oi0-f49.google.com Received: from [209.85.218.49] ([209.85.218.49:33622] helo=mail-oi0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C2/B0-34457-4E9B3055 for ; Fri, 13 Mar 2015 23:32:38 -0500 Received: by oibu204 with SMTP id u204so2396675oib.0 for ; Fri, 13 Mar 2015 21:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kN6paA/BkWSgVL2M4kig2OUAkr4Se678QAajSbnPD2o=; b=Z6YP+tRRjZtu7dhsnuE1Cn32gHydzwtwrJjNE0OF7lCmJ3i1apIEwCfVmai/vtmucD 0drcQHC/bgI8DqEjTRLRgHERlGBRtVkYpsV062MNdb5XuTR5fSHvYRKmIC4agtIKsJ7s vDHvnjagr9NGC0jyKCcBI1rBsYGV3P+k6dTEadgiiO5eBW0C6R/S7E68yt7EliYKDVZ1 GXSOD7csqjxRk8SoJuzgd6guaRm5to+9IOVG2LH+9MSS3GOW1jimcXmVkMXLWQ3VBSzA HEu5MuYkGNGBaZMTei2O5K8njZDc2ahYI+9ha1Cr3uB8KB2PNZz68hF+CjezM+RlOXEG clqA== MIME-Version: 1.0 X-Received: by 10.202.76.207 with SMTP id z198mr14652795oia.56.1426307554489; Fri, 13 Mar 2015 21:32:34 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.76.90.74 with HTTP; Fri, 13 Mar 2015 21:32:34 -0700 (PDT) In-Reply-To: References: <46F3AD65-6689-4E75-836C-968608F7D30D@lerdorf.com> Date: Fri, 13 Mar 2015 22:32:34 -0600 X-Google-Sender-Auth: JBjtWWR_5Exdyo676WfPVmVkfmI Message-ID: To: Rasmus Lerdorf Cc: Zeev Suraski , Dmitry Stogov , "francois@php.net" , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [VOTE][RFC] Coercive Scalar Type Hints From: levim@php.net (Levi Morrison) On Fri, Mar 13, 2015 at 10:31 PM, Levi Morrison wrote: > On Fri, Mar 13, 2015 at 8:50 PM, Rasmus Lerdorf wrote: >> On Mar 14, 2015, at 13:37, Levi Morrison wrote: >>> It seems that `float -> bool` is always disallowed. If I am correct >>> `int -> bool` is permitted for all values (not just 0 and 1), which >>> means that floats which can be converted to integers without dataloss >>> should also be permitted to be booleans. If a specific float can be >>> converted to an int, and all ints can be converted to booleans, then >>> the transitive property should hold for that float to a bool. >> >> The problem there is what does "without dataloss" mean? At which precision do you consider there to be no dataloss? > > Ah, I reread part of the RFC. It appears `float -> int` is unchanged > from current. This only confuses me more, though. If int -> float is > permitted, and float -> int is permitted, I do not understand why > float -> bool is not permitted. > > Can someone clarify this? I apologize; my hands didn't keep up with my brain. I meant that if `int -> bool` is permitted, and `float -> int` is permitted, then by transitive property I would expect `float -> bool` to be permitted. Can someone clarify why this is not the case? The RFC does not appear to justify this behavior (that I can find, anyway).