Re: [RFC] Disallow multiple default blocks in a single switch statement
| From: | Kalle Sommer Nielsen | Date: | Wed, 13 Aug 2014 15:20:14 +0000 |
| Subject: | Re: [RFC] Disallow multiple default blocks in a single switch statement | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76489@lists.php.net to get a copy of this message | ||
Hi
2014-08-13 13:02 GMT+02:00 Ferenc Kovacs <tyra3l@gmail.com>:
> agree, and I thought about mentioning that, but I left that out, because
> I'm not proposing to remove that ability (and I see more use-cases for that
> as mentioned in my previous email) but stating that this patch would make
> an arbitrary distinction between the normal and the default cases.
In PHP we already disallow overriding $this, like:
class A {
public function B() {
$this = 'hello'; // error
${'this'} = 'hello'; // error
${'t' . 'his'} = 'hello'; // works
}
}
so agreed too, we cannot disallow such cases that can be variable with
any gain, and it does make sense you cannot with $this, but if you
hack it like above, then you are asking for trouble anyway
--
regards,
Kalle Sommer Nielsen
kalle@php.net