Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93878 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80414 invoked from network); 10 Jun 2016 16:16:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2016 16:16:51 -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:46773] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/00-14797-1F7EA575 for ; Fri, 10 Jun 2016 12:16:50 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 481C32146C for ; Fri, 10 Jun 2016 12:16:47 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 10 Jun 2016 12:16:47 -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=blL7EeCQPUJvbDw 3/3NlEeQ550A=; b=DR6L/4zTFghBeHItw/mfViCl5IjXw0pnjliYvxvYk5Jc9QB zIP62QvfaV1bZ6eSyP2PLi/QpAaPGb19iq84pA6fsl8z/m13jFtUv9vjyB0TQQQH oMZuAS0AQFo+PenfwBGilHgYAJqASc/EAeNFG3SYzQEM4qKHBdPiqfbRjLkM= X-Sasl-enc: LiV7cmyq0X32IsC8YXcAVuwbQoVAiM38xSBngR05kB6K 1465575406 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 AF012F29FC for ; Fri, 10 Jun 2016 12:16:46 -0400 (EDT) To: internals@lists.php.net References: <2f0b0366-de16-25ef-f5ca-a03fb7d6f38b@zend.com> Message-ID: <575AE7EE.7050208@garfieldtech.com> Date: Fri, 10 Jun 2016 11:16:46 -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: <2f0b0366-de16-25ef-f5ca-a03fb7d6f38b@zend.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 10:01 AM, Dmitry Stogov wrote: > >> To clarify though, didn't Wordpress and Mediawiki see only a 0.1% >> slowdown? In my opinion that is definitely a tolerable performance hit >> for such a feature. > I don't see any big value in this feature. > Most framework access their properties through getters and setters > anyway. > They can be and should be used to provide type-safe API. > Another level of protection that makes slowdown instead of expected > speedup, doesn't make any sense for me. > > Thanks. Dmitry. Needing an explicit getter and setter (and the overhead of the function call) just for type checking is a bug this feature would obviate. If the only value of the getter/setter is type safety, then you're better off not using them. (There are other reasons to have getters and setters, and I'd still love to see the property accessor RFC reborn, but that's a separate issue.) Additionally, typed properties provides a terser, more self-documenting way of communicating the property type and thus expected behavior. I've written several doctrine classes, for instance, that are 5 lines of properties and 30 lines of getters/setters/docs boilerplate. If that boilerplate can be reduced or eliminated, that's a win. It also provides better introspection capabilities for ORMs and similar serialization tools. Yes, in some cases richer data than this RFC provides is helpful but not always. In many cases this would be sufficient to build automated safety into automated tools. (ORMs, serializers, validators that now don't need to be written at all, etc.) That seems like a worthwhile trade-off for a <1% performance difference in a real-world application. --Larry Garfield