""Colin O'Dell"" wrote in message
news:cajarsptqpkz9xsp6jf3gpm7hn39kdqpxcx4r5yn8hsohwo1...@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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php