Re: RFC: C-sharp style property get/set syntax for PHP
| From: | Lester Caine | Date: | Thu, 02 Dec 2010 14:44:30 +0000 |
| Subject: | Re: RFC: C-sharp style property get/set syntax for PHP | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50823@lists.php.net to get a copy of this message | ||
president@basnetworks.net wrote:
javascript and C++ both do implicit type conversion (coercion) the same as PHP. You will have to prove that this is NOT the norm. There was a big debate a long time back on stopping implicit type conversion in C++ ... it did not get anywhere. What I am probably asking simply because I don't know is what language are you referring to as I've not come across any. If it's C# then that would explain it ... THAT was created by people who did not accept the consensus agreement in C/C++ ;) -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.phpYou have got me there. = is assign == is equal value === is equal type and value At least on all the languages I've been using recently ... where is this a problem? In any language that does not have === it is like this: = is assign == is equal type and value That is where the confusion comes from. People do not expect "0" and 0 to be equal, because they are different types.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?