Re: Re: New Package SPL_Types
| From: | Marcus Boerger | Date: | Sat, 04 Mar 2006 15:33:14 +0000 |
| Subject: | Re: Re: New Package SPL_Types | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-3576@lists.php.net to get a copy of this message | ||
Hello Michael,
Saturday, March 4, 2006, 4:21:24 PM, you wrote:
> Marcus Boerger wrote:
>> 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)
> Looks quite interesting. Is it based upon pecl/operator?
No just on it's own besides using a few of SPL's header and infrastructure.
> How about naming it SPL_Extras or similar (which wouldn't limit the
> package to the term "types")?
I wanted to keep it to this kind of Type handling addon. If more is
necessary more SPL_* addons should follow.
Best regards,
Marcus