Re: New Package SPL_Types
| From: | Marcus Boerger | Date: | Sat, 04 Mar 2006 15:35:44 +0000 |
| Subject: | Re: New Package SPL_Types | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-3578@lists.php.net to get a copy of this message | ||
Hello Andi,
No just on it's own besides using a few of SPL's header and infrastructure.
By working on it i found a tiny issue in the engine which is fixed already
but that's it. Maybe you remember our class const-registering handler. That
would *maybe* allow nicer handlers and more tweaks like being able to fast
sorting of the allowed values and so on but it's not necessary at all.
best regards
marcus
Saturday, March 4, 2006, 4:20:28 PM, you wrote:
> Does this require any engine changes or is it purely internal user-land?
> Andi
> At 04:46 AM 3/4/2006, Marcus Boerger wrote:
>>Hello guys,
>>
>>
>> i'd like to add a new package called 'SPL_Types' that adds enum support to
>>PHP and might later on add stuff closely related to 'AutoBoxing' (actually
>>that is a side effect/a trash product of it).
>>
>>Example:
>>
>>class Weekday extends SplEnum
>>{
>> const Sunnday = 0;
>> const Monday = 1;
>> const Tuesday = 2;
>> const Wednesday = 3;
>> const Thursday = 4;
>> const Friday = 5;
>> const Saturday = 6;
>> const __default = Weekday::Sunday;
>>}
>>
>>$e = new Weekday;
>>
>>var_dump($e); // shows object of type SplEnum
>>var_dump((int)$e); // int(0)
>>$e++;
>>var_dump($e); // shows object of type SplEnum
>>var_dump((int)$e); // int(1)
>>var_dump($e + 3); // int(4)
>>
>>Anyone pro/contra?