Re: [RFC] Enum proposal (yet another)
| From: | Stas Malyshev | Date: | Thu, 23 Feb 2012 18:34:46 +0000 |
| Subject: | Re: [RFC] Enum proposal (yet another) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57977@lists.php.net to get a copy of this message | ||
Hi!
If you're going to go that far, why not make a flyweight enum type? (Basically what's described here: http://c2.com/cgi/wiki?FlyweightEnum )... Right now, it's a hack to get typing in place to let you pass an integer where a class is defined (the public function foo(MyEnum $enum) bit). If you used a flyweight, you could literally type-hint.Again, it looks like you are trying to introduce strict typing into PHP. I do not think it's a good idea, for the reasons I described at length in previous discussions, but you're free to try. However, I don't see how changing the language to make it easier to do partial backdoor strict typing is a good idea. Bringing Java as an example only supports this point. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227