Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83393 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26191 invoked from network); 21 Feb 2015 15:18:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2015 15:18:11 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.182 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.217.182 mail-lb0-f182.google.com Received: from [209.85.217.182] ([209.85.217.182:39945] helo=mail-lb0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/97-08895-1B1A8E45 for ; Sat, 21 Feb 2015 10:18:10 -0500 Received: by lbdu10 with SMTP id u10so11367796lbd.7 for ; Sat, 21 Feb 2015 07:18:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Luh7QGkRysdZ5dR4SpBSPTe17kXIFY8T+edBJpN1PtE=; b=pGdhxep/8/lM85HrbQyClWmK6Y+d0EliZfXzYXaMPVmzhQDNJczxxZAuS+P80/MfhA FvGruF9TppJrEDNmxBgZj+pUtLZYmy24rKlGcVp6T5g2tRfn+EDK6OQUfhXf+L9DMgUj hCA2tPtGDEypMKOUlCc4v6ENPqysmPS57DAr47FXlGu9mxwNThWdEvDGoC1VzhH7Mq8H FWbUByotFGMrCKhYjAJO/nI+DkWADyu6c29DX9JTBT3h3cek+gSCqs2AAIC4q8INXQr1 j0MpWUcFN1XgZviMK6ADGJfVZcz9uUdsV9Y/5KVrZlxVA9/q7fAB1bpOMlT7ue7+8xli sa4w== MIME-Version: 1.0 X-Received: by 10.152.207.37 with SMTP id lt5mr2496000lac.38.1424531885361; Sat, 21 Feb 2015 07:18:05 -0800 (PST) Received: by 10.25.43.9 with HTTP; Sat, 21 Feb 2015 07:18:05 -0800 (PST) In-Reply-To: <059701d04d73$bf9a4280$3ecec780$@php.net> References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <022801d04ab1$4a0c47d0$de24d770$@php.net> <1913e09d7f52541901d8574d2080a63f@mail.gmail.com> <7a5d96b34b98ec1f3ee17be7fa6a1e81@mail.gmail.com> <2CBDEB67-3DE3-437D-9AF3-0E6A92027244@zend.com> <4cc0c81c7199a452534bb8edcdb19914@mail.gmail.com> <54E589F6.9030002@garfieldtech.com> <54E66569.8000709@garfieldtech.com> <059701d04d73$bf9a4280$3ecec780$@php.net> Date: Sat, 21 Feb 2015 10:18:05 -0500 Message-ID: To: francois@php.net Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Reviving scalar type hints From: ircmaxell@gmail.com (Anthony Ferrara) Francois, On Fri, Feb 20, 2015 at 8:14 PM, Fran=C3=A7ois Laupretre = wrote: > Hi Anthony, > > I guess you would keep supporting __toString() ? So, you should probably = consider 'string' as 'string|object'. > Adding this case to 'float' meaning 'int|float' and 'callable' resolving = to 'string|array|object', are you sure it's worth the pain implementing and= supporting a dual-mode mechanism, compared to the ruleset I am intending t= o propose (currently in draft): https://wiki.php.net/rfc/zpp-conversion-rul= es ? No. The rules are quite clearly explained in the RFC. The only thing that can resolve a string hint is a string. __toString is a form of cast, and hence disallowed in strict mode (because 1: it's not explicit, 2: it loses significant information). Callable is an existing rule, which is not subject to the "strict" discussi= on. > Actually, using such ruleset, I guess you could infer less, but the diffe= rence wouldn't be so important. > > Only 3 conversions still use value, from which one can be made type-depen= dent-only if requested during discussion (float to int proposed as lossless= -only). Every type except int, float, and string are also proposed as 100% = strict. None of the conversions use "value". Int, Float, String and Bool all behave precisely about type. No runtime value information is used (only runtime type info). Please read the proposal and see what it says. Don't judge it by what you assume, but by what it says. Anthony