4 ms·
> It was consistent with the thing it inherited most of it's syntax from so that makes it inconsistent? It is also internally inconsistent in so many ways. Ha
by TheDong 10y ago
> It was consistent with the thing it inherited most of it's syntax from so that makes it inconsistent?
It is also internally inconsistent in so many ways.
Half the array functions take arrays as the first arg, the other half the last.
explode and implode have different argument order requirements (one is strict, the other works either way).
Functions have a grab-bag of errors from returning null to false to 0 to strings to requiring error\_get\_last to even requiring an object specific error function (DateTime::getLastErrors).
Functions were named to make them have more randomly distributed hashes (http://news.php.net/php.internals/70691 http://news.php.net/php.internals/70691). Functions randomly do or don't have underscores, sane order, etc.
Some apis are in terms of objects (DateTime), some are not (getdate).
The whole thing is far less consistent than C. Some inconsistencies are from C. Most are PHP shit layered on top.
> You shouldn't be judging the way operators work in one language with the way they work in others. Is lisp inherently bad since it's operators are prefix and not infix? No I'd say not, it's just different.
It's a C-like language. Every c-like language does it the other way. I will totally judge a language that makes a decision that makes programmer's lives terrible with no justification. In this case, it's different in a way that often leaves to bugs and surprises.
- gravypod 10y agoC++ is a C-like language but C++ muddies up the difference between some operators due to operator overloading. This is an inconsistency. Do you support that? No one will ever be able to convince me that "<<" and ">>" make sense to be read and write.
- __david__ 10y agoThat's not the same thing and you know it. C++ didn't just randomly change the associativity of one of the operators. PHP screwed up ternery in a way that makes zero sense (ie, it's wrong in 99.99999% of use cases). It still catches me (and my colleagues) off guard even though we have years of collective PHP experience.
- TheDong 10y agoIt doesn't matter, we're talking about php not C++. But yeah, "<<" and ">>" are at fairly internally consistent within C++ and don't generally confuse programmers or cause significant bugs in my experience, so I don't find them problematic. They did seem a bit weird at first, but they didn't cause significant problems. Perhaps they do for you, and I accept your complaint about those operators as valid actually, but it's on a whole different level of badness than php, and again, we're talking about php. Just because "other languages suck" doesn't mean php doesn't, so that's not a valid argument against anything I said.
- gravypod 10y agoI'm saying neither of them suck. They both have small things "Wrong" with them that are only "Wrong" because I don't like them. >they didn't cause significant problems That's not a valid criticism of any feature. I'd say that the worst feature of any programming language yet has been pre and post -- and ++. Some of the nastiest bugs I've seen have come from there. In both cases I avoid them. I only really use -- and ++ if I need to, just like ternary operators. > Just because "other languages suck" doesn't mean php doesn't, Ok what about other languages that are good? Python's ternary operator isn't the same as C-style languages but I still think of Python as being good.