>> Its not a matter of consistency - Properties, as a cross-language
>> concept
>> are not meant to work that way.  You need to think of a property as a
>> set
>
> Meant by whom? Is there some law of universe that prevents us from
> implementing the feature?

Its a defacto standard.  Of course there is nothing stopping PHP from
implementing properties that way, but by going against the standard set by
the rest of the industry, it is very confusing for programmers coming from
other languages to learn PHP.  A good example is how "==" works
differently in PHP than in other languages.  In PHP, "===" works like "=="
does everywhere else.  "(string)'0' == (int)0", for example is true in
PHP, but false in most other languages.  I have had countless
conversations with PHP developers who claim the language is "broken",
because == does not work like they expect it to, after which I have to
explain === to them.  This is because PHP goes against the defacto
standard.  Maybe it would have been better if == and === had the opposite
meaning, as to not squash the standard?


>> of two methods that just have a pretty syntax.  Methods cannot be unset,
>> and nor should properties be allowed to.  isset() should simply tell us
>> whether a property with the specified name is part of the class or not.
>
> If you need methods, why not use methods?

Because properties are only meant to be a pretty syntax for a get/set
method.  Thats it!  I don't know of any other special behaviour in any
other language that lets you "hide" properties or anything else like that.


>> isset() in the way you suggest would just be confusing.  It would allow
>> is
>> to say that a property does not exist, when in fact it does exist.  This
>> is not logical.
>
> Sorry, from your answer I don't understand - what happens when you call
> isset($foo->property) and unset($foo->property)?

You make a good point.  If we can't unset a property, than we lose
consistency with regular variables which I guess ruins the point of
properties.

- Dennis


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to