Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91634 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85424 invoked from network); 11 Mar 2016 10:57:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2016 10:57:36 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.50 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.50 mail-wm0-f50.google.com Received: from [74.125.82.50] ([74.125.82.50:37764] helo=mail-wm0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/05-50603-F94A2E65 for ; Fri, 11 Mar 2016 05:57:35 -0500 Received: by mail-wm0-f50.google.com with SMTP id p65so12563953wmp.0 for ; Fri, 11 Mar 2016 02:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=rGcFGc4I+mPRwx9xecFCrt9Xi3B4LzR3CGKn+jNaJTw=; b=0+xDsRebG2mnFPHGFkwuqFxjXMaFWF4Qu3FQq0qydT9on1TDCBfX/oYgMxClBAQjEK aHyy4FffUIO0iwImO2zwyIQkAHSHP6w+h0osTaA2dLX2JU5fPNjKeJATbRjUU4Rvxf+J uq39cbe+uXJtBnbBxopsbf5CUBx7Qo5dSRrOh/qOZzOfes4T9OTLLaMUueXIiF1cSxV6 Y8ds+mwJUd7VUZ5iW4NI8hdF1uBdGXmj2oG6CIptZwAyI3nqjXENYB4s5rLdBdMAEXSe vXF8XG0LQWrq9Ql52pRqFWbbgMELsiz5mydjPRCxasu4ep98ThdmtBuc7II0Z+OPYcFv ARVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=rGcFGc4I+mPRwx9xecFCrt9Xi3B4LzR3CGKn+jNaJTw=; b=g62zx0cRBHlq4FS8r3XG5n39c/B7yqh+fHa7Orej67YEeguQhlc2ioxPMn4+EFd4PD XqeL1rwqtzO4aJ/mCusi2l0X/El/w5/ok0G+1LTw6TMF5r4ahSR6KMF/E5vb638HS9YR WLgsWpsaMJuxytXtCpHqkDHjl4O7x1joxab/KxrKYBysjTV3UOKxs9xPb6M9qlyJK+sD K3HALFEaPx0Qf4jCBc87jlqZMUK6HZticb7KHu/rHbF0l8PGiRnjlOVAEBsw4ykDAf6u ZIYQOkxezuO7fWxsuJZgtvGGIFK22GDXf2wdO99YDlDQuGiBBx7CTTM6MR06hEKZ5dk8 GYSA== X-Gm-Message-State: AD7BkJIZ91WgwbM/dZYNSF0WGSZtFtDLGCuqBfpEZWNC+APvtmXyYXq6/8xF5yJIo3fS2A== X-Received: by 10.28.55.74 with SMTP id e71mr2252821wma.26.1457693852458; Fri, 11 Mar 2016 02:57:32 -0800 (PST) Received: from [192.168.0.152] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id t3sm7900951wjz.11.2016.03.11.02.57.31 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Mar 2016 02:57:31 -0800 (PST) To: internals@lists.php.net References: Message-ID: <56E2A454.7090206@gmail.com> Date: Fri, 11 Mar 2016 10:56:20 +0000 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; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC Discussion] "var" Deprecation From: rowan.collins@gmail.com (Rowan Collins) Jakub Kubíček wrote on 11/03/2016 10:03: > From the RFC: > > >> var is therefore a limited subset of public. > > No, this is wrong. `var` was here much much longer than `public`, therefore > `var` is not a subset of public, but rather `public` is _an extension_ of > `var`. This is like arguing based on the origin of a word, rather than its current meaning. Regardless of which came first, within the language as it is today, "var" can be used in certain places as a synonym of "public". That is how the engine sees it, and always has been - private and protected visibility didn't exist in PHP 4, so you could write a patched version of PHP 4 that recognised "public" as a synonym of "var", and it would behave exactly as expected. > The keyword `var` is also unique for it's semantics in the later > versions of the language viz. previous discussion: > > - `var` represents not any certain visibility, it states that the > visibility of property is yet unspecified This is not really semantic, but pragmatic - seeing "var" is a smell that the code hasn't been updated to properly restrict visibility. It is a disadvantage of running an automated conversion script, but it is not a disadvantage of deprecation as such (which would just make the smell stronger). In fact, you could make the conversion script add a comment to each variable it changed, and get a stronger smell that way as well. e.g. "var $something;" -> "public $something; // TODO: property may not need to be public" > - `var` can semantically also represent an internal dependency, as I have > described earlier As others have said, this is a very odd hack added in one particular code base, as a workaround for lack of package visibility / friend methods / etc. Since it's just a convention, it could equally be done other ways, such as @internal docblock annotations or a prefix on property names - both of which would actually be more visible in IDEs. I would put this in the same class as an overheating spacebar [https://xkcd.com/1172/] - it's not the language's responsibility to support every workflow that exploits unintended functionality. Regards, -- Rowan Collins [IMSoP]