Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98484 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64926 invoked from network); 11 Mar 2017 14:06:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2017 14:06:26 -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 209.85.128.182 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.128.182 mail-wr0-f182.google.com Received: from [209.85.128.182] ([209.85.128.182:36145] helo=mail-wr0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/B2-38004-16404C85 for ; Sat, 11 Mar 2017 09:06:25 -0500 Received: by mail-wr0-f182.google.com with SMTP id u108so79713190wrb.3 for ; Sat, 11 Mar 2017 06:06:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:cc:from:message-id; bh=k3tunZrdqdUPntF/IAu5YX12n8iL50rOOUwWApRhz5A=; b=jA4g+OlEpHv8kQuyb/28FyPG5tpbOE0jBBfVyBOGiplTA3+smBPwhxyMo88P8m9U5r qHG4qHxPEQ+4uzmskYx2O9xXJirWTFLsa9wXSzYl/r7wddkwHQy6KM3u1PaXfAqyv2uj RSmiNEi6ceRslhy+1SEvh4a2UenLtvFzehO8478e1uIFjauRfB1d9ON7vSs/12aBqM7N C5Qep/TWyx0mr6CmeE/RrmGHiP+YrfSxGtIUtAlOKB6xEeF5eaI30ywsigkPksEhfErG +4iOgZyBRP/0471C/Uj1C4aIit8gkG2xkZjobqvR8INTlBkyt9xufJqvjMxAaiHUiLxr 7vbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=k3tunZrdqdUPntF/IAu5YX12n8iL50rOOUwWApRhz5A=; b=qyRnEQBjPBJAlxUvh/ZwYEytwycCK9bGPkL8NwhZ7Ij3LlsdZuEsEVsvQDsyDvFdq0 0nsLXKxeneF8XDC+10fBbDus22Frk6tcbxg94wmdtiSOpjIdm4Ck01B2xyqfp6hMnJNA pjVYC8LHrKzb5BqCz4o6pH91QRZsc4KTlUZAJFc0dIdEUKmGCAZDQRkNmStndKFE8FPV 6lJo2+dv/5BzyAzcDNOeuUnABU7QqKhguxlyexhSViG55S+FyTjSWliKX2GG/Nur6g7s HEl18Ya2rW/PAXGYEvOBmP6gqUoI1279sEppOTPiBInigda0V18zk9u2gfPaM0Zj8mF/ V5lw== X-Gm-Message-State: AMke39mqws1MifDls7dlCz3rWbsvFkzVrHXPEEITnJbmY/JW0VUvVVvUmLx+qPTHb/UFsA== X-Received: by 10.223.155.211 with SMTP id e19mr19590634wrc.74.1489241182789; Sat, 11 Mar 2017 06:06:22 -0800 (PST) Received: from [10.93.248.190] (94.197.120.166.threembb.co.uk. [94.197.120.166]) by smtp.gmail.com with ESMTPSA id k195sm3788432wmd.7.2017.03.11.06.06.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Mar 2017 06:06:21 -0800 (PST) Date: Sat, 11 Mar 2017 14:06:19 +0000 User-Agent: K-9 Mail for Android In-Reply-To: References: <24efb0e7-b0e3-68ed-5f42-2d5481f8f291@gmail.com> <44add374-6c4b-399a-c542-8d7f100dfaa3@fleshgrinder.com> <2AB030D8-9677-4E0E-8215-07D77910E51B@gmail.com> <6BDFA788-B52E-42BE-8794-50959D3A81BE@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: Andrey Andreev CC: "internals@lists.php.net" Message-ID: <5D9BF96B-4566-4B67-836D-E8289F7AE32A@gmail.com> Subject: Re: [PHP-DEV] [Discussion] is_string(), string type and objects implementing __toString() From: rowan.collins@gmail.com (Rowan Collins) On 11 March 2017 13:53:10 GMT+00:00, Andrey Andreev wr= ote: >I don't disagree with that in general, but strictly rejecting strings >and other non-integer values would alleviate the problem for a >majority of cases; i=2Ee=2E would solve the 90% problem=2E I guess I just don't see that as 90% at all=2E The interesting values to d= etect are the ones that are out of range, not just that somebody wrote '4' = instead of 4=2E >What I strongly disagree on is that I should be happy with coercion, >and the almost religious resistance against (non-overridable) strict >scalar typing=2E For me, it's about division of responsibility: a library defines a contrac= t, and it's up to me how I meet that contract=2E If I go through writing (s= tring) everywhere, or use a pre-compiler that does that for me, I'm meeting= the contract=2E It's no more the library's business than whether I use an = IDE with dozens of templates, or hand craft my code in notepad=2E All coerc= ive typing does is turn that pre-compiler on by default=2E What's more interesting to me is how the library can express the contract = it actually wants, and scalar types by their nature make for weak constrain= ts=2E All of the examples you've given are good illustrations of that, and = that's why I've been trying to tease out some things that the language coul= d do to actually help with those cases=2E Regards, --=20 Rowan Collins [IMSoP]