Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91287 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93788 invoked from network); 18 Feb 2016 21:14:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2016 21:14:40 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.28.122 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.28.122 mx201.easyname.com Received: from [212.232.28.122] ([212.232.28.122:58553] helo=mx201.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/30-27267-F3436C65 for ; Thu, 18 Feb 2016 16:14:40 -0500 Received: from cable-81-173-133-29.netcologne.de ([81.173.133.29] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1aWVuG-0006In-S3 for internals@lists.php.net; Thu, 18 Feb 2016 21:14:37 +0000 Reply-To: internals@lists.php.net References: <56C61BE2.3090509@php.net> To: internals@lists.php.net Message-ID: <56C63430.4040709@fleshgrinder.com> Date: Thu, 18 Feb 2016 22:14:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC Proposal] var keyword deprecation/removal From: php@fleshgrinder.com (Fleshgrinder) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2/18/2016 9:58 PM, Colin O'Dell wrote: >> What are your reasons for this proposal? >> >> I can think of multiple reasons why this might not be a good >> idea, but the only reason that pops to mind for getting rid of it >> is to make PHP work like a different style of language. > > I'm proposing this change because it will remove duplicate > functionality from the language. > > In PHP 4, "var" was the only way to declare a class member > variable. PHP 5 introduced three new keywords for this purpose: > public, protected, and private. "public" is functionally identical > to "var". According to the docs: > >> Class properties must be defined as public, private, or >> protected. If declared using var, the property will be defined as >> public. > > This is great for backwards compatibility from PHP 4, but it > ultimately results in having two different keywords which do > exactly the same thing. Does PHP 7 really need two keywords for > declaring public class members? > > We're already removing PHP 4 style constructors in favor of the PHP > 5 style ones, so why not also remove the PHP 4 "var" keyword in > favor of the PHP 5 style keywords which explicitly state the > visibility? > > For the small percentage of projects which still use "var", > upgrading their code would be dead simple: just replace "var" with > "public" everywhere you see it. I'm sure somebody can easily whip > up a tool to automate that process. > > Because current usage of "var" seems low and the upgrade path is so > simple, I don't think its a bad idea. > > Colin > +1 for Colin’s proposal. Duplicate functionality results in confusion and this should be avoided and cleaned-up. There are already way too many aliased functions just to ease the learning curve for people that come from other languages (whatever that should bring to PHP). - -- Richard "Fleshgrinder" Fussenegger -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWxjQwAAoJEOKkKcqFPVVrtM4P/0KQbfYSTvRAuAUiVeQZwsUO 0W5yXlBDRkQfvrxh/xdirMIw0fX25tipsB++93pJ81ay00K2o623KmMKzM4U1rzu Pfk+HjnGN8iAQSGI0lvHCbgQLnAScOxzllB7NdchhyCP+LwTappDlT3Il/2THTg0 8ilMjBKOdG0tvwicYk4WYc8I9Z1Ryw37JUTp15sk0rE3M6OKRD7KUCVYZ1EfDTTW 0XGwfoOYT9yPEncw/p5jN0SM612kd25/4WfURsjjVhrjHk3l4UxRIh8SKacI/lWe Zs/WAJa/Nh8gJredgiOa7KO8VnNaeNTnJlXtnhSibdLMJ7lZPUz/4Wnum3/AHAte 2bqT+/5i6AKAi+izFl5IISBL7jh4cI9F1OFT3Z0IdKy1WXJtA37s4mHRmZLMcVvw HIJTDiBmMqE8PZVnc/Rf5A3QsQoC7h02Rnol7a5PU9990oDKW4lqxfXJRVLZT4Zf GlImZzdZ1dkzTJlTXLGSEthPrjR3IRsR0JCls5baYLg09OeJAOvOngKeJXZsIz7d BgoV32wlXtaWWp0hM6RWoztXymLppN8yRWMDwNhqQO7mHAI498KJyoIa46DrUVix sp0fBOnF+1chDn9uwEkqCZrUMhb+UGQAuyJikDyQALUNmNyi4xTjdv+pjDr3X0Qf 3iz95r9fJF3XqYUsP44r =r05h -----END PGP SIGNATURE-----