Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82132 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49255 invoked from network); 8 Feb 2015 10:20:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2015 10:20:47 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:60433] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/B3-24707-D7837D45 for ; Sun, 08 Feb 2015 05:20:45 -0500 Received: by mail-wg0-f48.google.com with SMTP id x12so21314052wgg.7 for ; Sun, 08 Feb 2015 02:20:42 -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=O7P65eW4kgUGTJCrEzFbv2yjroJsBxiMshfJBFiOzLk=; b=eux15bug4KXtYzmVcge1lnqPqKSI8zpROib3Bz0hJrk1qdZyo4khv17RckGe7fweyy Apjlo2mxSE0uSyqBajNDBVkQyZS0Oai++PRUaLJxKjVEuGj9jFXtKUOCNT0RZK85nKbE 0/zouoF3FcLE8Kk97H8342dJaSdFVGiMNJyqR6CRd/BT/WYXXXaUon7UJyPKVedzD87O XNkurIx0i4LAf54cuenjdh/ISACBEvwFjLeIAZ7kx8cGlNgKKy+T2Qi9MzdtFSq6eHiE xR80vuMd0txt8uoSzRjGbqBjoNp9URY5tLS0CIeIJWNgdKMMA4y/f7SoexUqq/L3/4le ZIqQ== MIME-Version: 1.0 X-Received: by 10.180.39.35 with SMTP id m3mr12854243wik.3.1423390841916; Sun, 08 Feb 2015 02:20:41 -0800 (PST) Received: by 10.27.10.138 with HTTP; Sun, 8 Feb 2015 02:20:41 -0800 (PST) In-Reply-To: <54D6CC39.50708@lerdorf.com> References: <8703B53E-2C4A-4AC6-95C4-D4F19C6D5221@ajf.me> <9E1C2427-0295-4F3E-BD29-04DA84321067@ajf.me> <54D6CC39.50708@lerdorf.com> Date: Sun, 8 Feb 2015 11:20:41 +0100 Message-ID: To: Rasmus Lerdorf Cc: =?UTF-8?Q?Pavel_Kou=C5=99il?= , Andrea Faulds , PHP Internals Content-Type: multipart/alternative; boundary=001a1134c9028252ef050e9101fa Subject: Re: [PHP-DEV] [VOTE] Scalar Type Hints From: nikita.ppv@gmail.com (Nikita Popov) --001a1134c9028252ef050e9101fa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Feb 8, 2015 at 3:38 AM, Rasmus Lerdorf wrote: > On 02/07/2015 05:03 PM, Pavel Kou=C5=99il wrote: > > I'm wishing more and more that the RFC doesn't pass (even though I'd > > LOVE to have typehints in PHP as a userland developer) and someone > > else will make a better version of typehints RFC for PHP 7, because > > this one feels really like you took an ok-ish RFC (one that would be > > good for PHP) and slapped a strict typing on it without enough > > research about strong typing in other languages. And as I said myself > > multiple times in the past, the declare syntax IS just ugly (and > > changing how code works by writing one line is an ugly principle as > > well, IMHO). :( > > I am not sure I would go that far. Andrea did plenty of research and has > tons of experience in other languages, I just think this approach is > misguided. I also wonder just how many people of those who voted even > bothered to download and try the patch. I tried it a while back on some > existing code and it was a nightmare. Does everyone realize that these > simple things break? > > tan(1); > echo strstr("test", "est", 1); > Seems like a case where one mans bug is another mans feature. While int->float conversions are debatable (and the answer may not be obvious if you consider bigints) I would definitely want the latter call to error. Seeing strstr("test", "est", 1) I would obviously assume that 1 is an offset parameter, like it is the case with many other str* family functions. strstr("test", "est", true) is a lot more obvious and I'll be happy if PHP yells at me if I'm sacrificing three keystrokes for a lot of readability. > Basically declare() does not respect function scope, but it doesn't let > you know that. There is a reason we haven't used declare() for anything > real. > This sounds like a bug more than anything else. It can be easily fixed. Nikita --001a1134c9028252ef050e9101fa--