The winding road to PHP 8's match expression
The winding road to PHP 8's match expression
Posted Sep 2, 2020 18:50 UTC (Wed) by mathstuf (subscriber, #69389)In reply to: The winding road to PHP 8's match expression by professor
Parent article: The winding road to PHP 8's match expression
Posted Sep 2, 2020 20:10 UTC (Wed)
by professor (subscriber, #63325)
[Link] (3 responses)
yes, i love PHP :)
Posted Sep 2, 2020 21:41 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
This mentality works for solo projects (and even then, more towards the one-off end of things). In my experience, having such sharp tools laying around with opt-in safety mechanisms make code review and later maintenance much harder. An explicit `fallthrough;` statement would have been a better solution rather than `break;`. Why? I find fallthrough to be the rarer case. Sure, Duff's device is cool and all, but I've written one maybe once? Seen it only a few other times? Making it have a few more keyword instances would have been fine (especially since your indentation is already all kinds of whack most of the time, doing `fallthrough; case …` would probably have worked).
> "i want everything on a silver plate and stuff i dont know about is someone else´s fault and thefor bad design" is just weird
I know about it and I even use it sometimes. I still comment when I explicitly mean for fallthrough to happen because I'm not the only one working on the code in question (even if another person isn't, years-later me might have to figure out what the code in question is doing anyways).
Posted Sep 2, 2020 22:29 UTC (Wed)
by professor (subscriber, #63325)
[Link]
This part i dont understand at all..
"Sure, Duff's device is cool and all, but I've written one maybe once? Seen it only a few other times? Making it have a few more keyword instances would have been fine (especially since your indentation is already all kinds of whack most of the time, doing `fallthrough; case …` would probably have worked)."
Posted Sep 2, 2020 22:56 UTC (Wed)
by mjg59 (subscriber, #23239)
[Link]
What we want is code that doesn't have bugs. All the evidence suggests that the number of people who can write code that doesn't contain bugs is extremely small, which means designing languages such that it's harder to write bugs is a reasonable choice.
The winding road to PHP 8's match expression
If i want a break i would put it there and if not i would not.. Todays (-fifteen years) "i want everything on a silver plate and stuff i dont know about is someone else´s fault and thefor bad design" is just weird.. PHP have always been what it is according to the manual (which is one of the best) but if you dont want to read it and dont know what you are doing you just dont know.. even if this is "crap" it made it possible to create some awesome (first) results without knowing anything (which made it great but also is the black sheep nowadays).
The winding road to PHP 8's match expression
The winding road to PHP 8's match expression
The winding road to PHP 8's match expression