Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81811 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6430 invoked from network); 4 Feb 2015 11:30:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2015 11:30:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.50 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.50 mail-qg0-f50.google.com Received: from [209.85.192.50] ([209.85.192.50:54275] helo=mail-qg0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/6A-55046-6C202D45 for ; Wed, 04 Feb 2015 06:30:16 -0500 Received: by mail-qg0-f50.google.com with SMTP id j5so641507qga.9 for ; Wed, 04 Feb 2015 03:30:11 -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; bh=8NwjCnapSa6rVFS2yKELzT9sGQf4FM7P4Z953HOiidk=; b=MOJKY7P6tR0X2V5DWLWGuC0SEXfaKP7YGSjNQLxNVIiVj7BjZKQYnUhwP/aA+gI9HQ 4gFPOJqNZ5wdL4qfk5Jlpp3BecVldsVtePPt+TYQIuSMaAJqgeYC9DcGfSphpnet1Z0i tppEoNPxsJ3Neio3PSBI/NkgQsGuDkOcPulzY4QzJaBi6rbW8rZavex5ntbb5P/mi2ev piW5OGuv1gqYArREShdozC3MAYHdtLk3DZ1fTLlbkIXjWLHxsUdshAG5bG7sM0hl7EaT vtY+L3W3mHFlUsLnbLRw/eIgWZxnGjAQxFkGIQD0HW+5cnWQr6OhcxuJ+cHWpaY+tzyR Rwag== MIME-Version: 1.0 X-Received: by 10.140.39.84 with SMTP id u78mr55801807qgu.63.1423049411490; Wed, 04 Feb 2015 03:30:11 -0800 (PST) Received: by 10.96.3.168 with HTTP; Wed, 4 Feb 2015 03:30:11 -0800 (PST) Received: by 10.96.3.168 with HTTP; Wed, 4 Feb 2015 03:30:11 -0800 (PST) In-Reply-To: References: Date: Wed, 4 Feb 2015 18:30:11 +0700 Message-ID: To: Andrey Andreev Cc: Leigh , PHP internals , Florian Margaine Content-Type: multipart/alternative; boundary=001a11c12968ab9468050e41828d Subject: Re: [PHP-DEV] What do we need strict scalar type hints for? From: pierre.php@gmail.com (Pierre Joye) --001a11c12968ab9468050e41828d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Feb 4, 2015 6:15 PM, "Andrey Andreev" wrote: > > Hi, > > On Wed, Feb 4, 2015 at 1:02 PM, Florian Margaine wrote: > > Hi Leigh, > > > > Le 4 f=C3=A9vr. 2015 11:50, "Leigh" a =C3=A9crit : > >> > >> What was wrong with: > >> > >> function x(int $y, string $z) { // strict > >> function x((int) $y, (string) $z) { // casting > >> > >> This was the best suggestion I've seen that covers the requirements of > >> both camps, and is still very clear how data is going to be handled. > >> > >> Authors who want their APIs to adhered to strictly can do that, > >> authors who want to accept anything and have it end up as their > >> desired type can do that too. > > > > Because it is then the callee who decides, not the caller, whether or not > > he wants strict typing. > > > > ... and apparently, this is the root of all evil. :) > > I am baffled by how the two-syntaxes suggestion is always so easily > dismissed by that argument. I'd argue that most people who support the > current proposal don't fully understand what declare(strict_type=3D1) > really does. As I've previously said - putting the caller in control > (and really the caller, not in a per-file context) makes it a > debugging tool, not support for strict typing. On the same line I think almost nobody here tries it. Code can make things easier to understand. On the other hand this debate has reached a sterile state. Try it, play with some small scripts, existing codes, report eventual issues (maybe related to this rfc or bugs in 7). That will help much more than what is being discussed endlessly here. --001a11c12968ab9468050e41828d--