5 ms·
Evolved shit is still shit. Half of issues mentioned here (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ http://me.veekun.com/blog/2012/04/0
by usamec 13y ago
Evolved shit is still shit. Half of issues mentioned here (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...) are still not solved.
- themstheones 13y agoI doubt that many of the main gripes about PHP will ever be solved without a "breaking changes" version like python had. The PHP community isn't likely to get behind something like that.
- tangledweb 13y agoI've always loved that fractal of bad design rant. Many of his gripes follow really neatly from his initial analogy of the hammer with claws on both sides. Let's say you want to hammer in a nail. You reach into a tool box and pull out something that you think is a hammer. Instead it has claws on both sides, and is in fact a nail puller. You don't know much about tools so you use it to beat in nails, all the while grumbling to your friends that it's a bad hammer. For instance, I don't see how you expect to "solve" most of the "issues" in that. The fact that the author does not like the way == works in a weakly typed language is not a bug. Sure, it present bugs in code when programmers don't know how implicit type casting works, but it's really nice if you do.
- eevee 13y agoHello, author here. You're not the first to scoff at my hammer description, but perhaps you can explain to me what kind of nail puller looks exactly like a hammer but with two claws, or why it would be useful to have the exact same tool on both sides of the handle. (This is still a PHP analogy.) I don't see how to solve most of the issues, either. That sucks, and I genuinely sympathize with Zend on this, but it doesn't make them not-issues. As I think I said, they'd be acceptable if they were reasonable tradeoffs, but many of them are not. Your == counterargument seems apologetic and trivially applied to anything: whenever a program is wrong because the language violated expectations, it's the programmer's fault for not having memorized some matrix of arcane rules. Languages aren't perfect and human beings have wildly differing expectations, but ultimately we only have programming languages to make it easier to express ourselves—no one's stopping you from writing the next big web 2.0 thing in x86 machine code. So yes, when it's difficult to reliably ask a language "are these things the same" without learning paragraphs of gotchas, that's bad. Glad you enjoyed the article!
- stephenr 13y ago> the language violated expectations its a language, you learn it. it doesn't adapt to you. I am slowly learning Thai. I am fucking terrible at it. I mean absolutely woeful. It's hardly the fault of Thailand or its people that their language has different sentence structure and different words than what I'm accustomed to, is it? Type juggling exists, there is an operator that does a strict comparison. Build a bridge and get over it, and yourself.
- eevee 13y agoThe people of Thailand didn't invent Thai, and it's unlikely that a handful of them could invent a new language and have it catch on within a few years. The analogy doesn't quite hold. Switching sentence structure is more akin to switching paradigms, anyway. There are no strict comparison operators for less-than/greater-than. === acts fundamentally differently for objects than for everything else. Alas.
- tangledweb 13y agoI think you are stretching the hammer analogy well beyond its useful limit. I've no idea what php function you think has a redundant left and right version, but to humor you, sure there are lots of nail pullers that have two similar sides or ends to attack different sizes. eg http://s.shld.net/is/image/Sears/00938076000 http://s.shld.net/is/image/Sears/00938076000 There are also lots of physical tools that completely reasonably do have exactly duplicated sides or ends because they wear out, but I don't see how you want that to apply to software. Talking about == is not trivial or apologetic. That's the way I expect comparison to work in a loosely typed language. I expect 0, 0.0, '0', '0.0', -0, 00, 0x00, null and false to be logically equivalent most of the time. If it also means that if I don't validate input from an http request 0=='0 foodle fish' also evaluates as true, then that's a cost I'm willing to bear.
- eevee 13y agoWould you expect "1.30" == "13e-1", since both are strings? How about "0xb" == "0xB"? 0 == "zero"? I don't see how this is anything but bugprone, and all to save you from actually saying what you meant and slapping a couple int()s on your input. Compare JavaScript, a language with much the same == problems, where the community generally advises against ever using == at all. CoffeeScript (different syntax that compiles directly to JavaScript) even translates == into ===, leaving the original buggy operator unavailable.