Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91316 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70932 invoked from network); 19 Feb 2016 09:25:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2016 09:25:15 -0000 X-Host-Fingerprint: 80.177.120.119 marston-home.demon.co.uk Received: from [80.177.120.119] ([80.177.120.119:8283] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/73-44579-A7FD6C65 for ; Fri, 19 Feb 2016 04:25:15 -0500 Message-ID: To: internals@lists.php.net References: <56C61BE2.3090509@php.net> In-Reply-To: Date: Fri, 19 Feb 2016 09:25:07 -0000 Lines: 4 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 16.4.3564.1216 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3564.1216 X-Posted-By: 80.177.120.119 Subject: Re: [PHP-DEV] [RFC Proposal] var keyword deprecation/removal From: TonyMarston@hotmail.com ("Tony Marston") ""Colin O'Dell"" wrote in message news:CAJaRsPtqPKz9XSp6jF3gpm7hn39KDqpXCX4r5yN8HsohWo1gDg@mail.gmail.com... > >> 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. This reason is not good enough. Leaving the "var" keyword in does not do any any harm, so what be benefit is gained by expending the effort of removing it? To be consistent you ought then to remove ALL other instances where there is more than one way of achieving the same thing, but how many of those are there? If the various duplications are still being used, then who decides which one is to be deprecated? For example, the short array syntax was introduced in version 5.4, so according your logic the original (and well used) long array syntax is now a duplicate and should be deprecated. How much effort would this require? What benefit would be achieved? >> 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? The PHP language is littered with more than one way of doing the same thing, so do you propose the removal of ALL duplications? >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. Why should long standing projects have to change their code just because you personally don't use and don't like the "var" keyword? Instead of tinkering with the language to achieve nothing but perceived "purity" why don't you stick to proposing genuine improvements? -- Tony Marston