Re: Re: [RFC] Match expression
| From: | Tony Marston | Date: | Sun, 10 Sep 2017 10:22:36 +0000 |
| Subject: | Re: Re: [RFC] Match expression | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100498@lists.php.net to get a copy of this message | ||
wrote in message news:7cd2884a-6606-4c3f-8f95-776fd277878b@Spark...
Hi TonyThe problem with implicit breaks is that it makes it impossible to group several conditions with a single break. My previous language use implicit breaks, and this problem really annoyed me. With PHP I have more control, and the fact that I have to insert explicit breaks I do not see as an inconvenience.… you sometimes forget to insert a break statement then that is your fault.Any bug in your source code is ultimately your fault. But as mentioned before human error is inevitable. You can make it easier for your users to make less mistakes though. Other languages (e.g. Rust or Swift) have implicit breaks in their switch statements. This has been done for a reason, I wouldn’t call this a non-issue.
They know what they want to achieve, and they have to know which language features are available to help them meet their objectives. The fact that some language features have turned out to be a big mistake is purely the fault of the people who introduced those features. Some programmers complain about some languages features even though they are useful features which work as advertised as are not deemed to be a mistake - take yourself for example who is now complaining about issues with the switch statement. If what you want to achieve can be done better with a series of if/elseif statements than the switch statement, then why can't you use if/elseif instead of making the language more complicated? -- Tony MarstonMillions of other programmers have no problem with the switch statementIt’s all they know. They don’t complain about null pointers even though it’s inventor calls it his billion-dollar mistake. The customer rarely knows what he truly needs.