Le jeu. 10 mars 2016 à 18:15, Colin O'Dell <colinod...@gmail.com> a écrit :

> Hello all,
>
> I have completed my initial draft of the RFC to deprecate "var" in favor of
> "public": https://wiki.php.net/rfc/var_deprecation
>
> I would greatly appreciate any feedback on this RFC, especially with the
> following:
>
> - Ensuring that all major arguments for & against have been documented.
> - Any impact this may have on SAPIs, extensions, or the opcache.
> - Any assistance or guidance on creating the patch (I've never written C or
> worked with the core codebase before).
>
> If you'd like to read the pre-draft discussion it can be found here:
> https://wiki.php.net/rfc/mailing_list_discussion
>
> Regards,
>
> Colin O'Dell
>

Hello,

Related to what's mentioned in the RFC under: "public Is Not The Same", one
can use "var" to declare a property without specifying its visibility and
this is true for method as well: "function" is equivalent to "public
function".
Forcing people to specify a visibility for properties and not for methods
would add yet another inconsistency in the language.

Besides that, there isn't 2 ways for declaring a property, but (at least) 3:

#1
class Example {
    var $foo;
}

#2
class Example {
    public $foo;
}

#3
class Example {
    public function __construct() {
        $this->foo = null;
    }
}

If I understand this RFC, example #1 is handled by it, but not #3.
Using #1 would emit a deprecation notice, but #3 wouldn't?
As far as I am concerned, I think it is still better to declare the
properties rather than not and this RFC would (somehow) favour not
declaring them at all than doing so with "var".

I'm generally in favour of not having duplicated ways of doing the exact
same thing.
I'm generally in favour of not introducing (uneeded) BC issues.
I'm not convinced that the number of people that will benefit the
uniqueness of declaring a variable would be greater than the one suffering
upgrade issues.
For that reason and the ones above I'm -1 about this RFC, even if I am not
satisfied with the fact we can still use "var".

Regards,
Patrick

Reply via email to