Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93880 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85918 invoked from network); 10 Jun 2016 17:28:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2016 17:28:53 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:49536] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/C0-14797-3D8FA575 for ; Fri, 10 Jun 2016 13:28:53 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5722520895 for ; Fri, 10 Jun 2016 13:28:48 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Fri, 10 Jun 2016 13:28:48 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=AsFYUF8waBZbo05 e/qJdddgEQxg=; b=TSOpPvTImPjToswm7dLXgMviCjdyJKraZMENu03uh4ZXa34 bENA9jUU+3REMFZQcmMj8IzfSCV6UC80NhyQbLLX0f79bDAMivCJSc4Vf46uq/A+ YiX3kpGC1lD9DnB5TpotR9S/xRs7QTEirjO9qIStnRZckqefq3ZKpLF3aBSk= X-Sasl-enc: 2H0/q9HJ3ppWXrlOa2T08T6FXfOuS1928NtzZm2qWgDm 1465579728 Received: from [192.168.42.5] (c-50-178-40-84.hsd1.il.comcast.net [50.178.40.84]) by mail.messagingengine.com (Postfix) with ESMTPA id 11D2ECCD24 for ; Fri, 10 Jun 2016 13:28:47 -0400 (EDT) To: internals@lists.php.net References: <2f0b0366-de16-25ef-f5ca-a03fb7d6f38b@zend.com> <575AE7EE.7050208@garfieldtech.com> <3246c813-95b4-a120-f1e1-9763edba0af8@gmail.com> Message-ID: <575AF8CF.2090101@garfieldtech.com> Date: Fri, 10 Jun 2016 12:28:47 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <3246c813-95b4-a120-f1e1-9763edba0af8@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: larry@garfieldtech.com (Larry Garfield) On 06/10/2016 11:57 AM, Rowan Collins wrote: > On 10/06/2016 17:16, Larry Garfield wrote: >> That seems like a worthwhile trade-off for a <1% performance difference >> in a real-world application. > > The problem is that the performance hit is felt even for code that > doesn't "opt in" to this feature. For an application that makes no use > of the feature, it is all cost and no benefit. > > I think PHP is at a cross-roads, and (if you'll forgive the stretched > analogy) at risk of going off-road and getting stuck in the mud. > > Option 1 is that the language remains inherently loose-typed, with a > few entirely optional features to provide type safety in specific > cases. If this is the aim, then the optional features should be as > unobtrusive as possible for the "default" loose-typed approach. Any > performance hit on untyped properties is a big deal under this > interpretation. > > Option 2 is that the language embraces "gradual typing" as a core > tenet of the language, with loose typing considered a "fallback". If > this is the aim, then there should be a coherent roadmap of what the > type system is going to look like. In this case, performance issues > might be considered an inevitable cost of improving the language; they > might also be reduced as the Engine is adapted to implement the roadmap. > > Option 1 seems more appealing, because it is easier to get agreement > for, but if we keep piling on the special cases, we're going to end up > with the worst of both worlds. I see the technical problems with > creating a reference to a typed property as a sign of this: we are > creating more of the frustrating inconsistencies that PHP is infamous > for, because we're trying to have our cake and eat it. > > For the record, I'm not entirely sure which way I want the language to > go, but I think it's a decision that needs to be made, and soon. > > Regards, This is a very accurate and well-stated assessment. I agree with the possible paths. From the code I see in the wild, it feels like the gradually/mostly typed camp has already won in terms of production code. Most of the PHP Rennaissance-era systems (the stuff that came out in the last 5-6 years or so) is class-heavy and as type safe as PHP has allowed, most of the time. The exceptions are the highly functional bits, where the language doesn't offer as much support as it does for class-family typing. There's almost certainly some projecting going on here as I'm a mostly-typed fan myself, but my sense is that the PHP user-space community has already decided they want a robust typing system they can use in most (but not all) cases. The engine should embrace that and catch up, with a well thought-out approach to typing. If it takes a bit longer to get certain features as a result of that attention to a coherent roadmap, I am happy to make that trade-off. --Larry Garfield