[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-dev
Subject:    [PECL-DEV] Too much magic ?
From:       "l0t3k" <cshmoove () bellsouth ! net>
Date:       2003-10-22 1:53:30
[Download RAW message or body]

hey ya'll,

i'm working on an I18N extension for PHP5 which takes full advantage of the
new OOP support in ZE2, including the cast handler. right now you can do
something like this :

    I18N_SetOutputEncoding("Latin-1");                    /* set global
output encoding */
    $unistring = new UnicodeString( $sjisString, "sjis");    /* convert from
sjis to Unicode */
    echo "Latinized string : $unistring";        /* uses the cast handler to
convert $unistring to latin1 */

my question is - is this too much magic, and can it come back to bite me in
the butt ? i think it makes sense in this instance, but i think generally
string casts of objects (in Java especially) are used primarily to get a
representation for debugging rather than end-user output (IOW, give an
indication of internal state). another example (not yet implemented) is as
follows :

$cal = Calendar::createInstance(TimeZone::getDefault(),
Locale::getFrench());

echo "Current time is :  $cal \n";    /* mardi 21 octobre 2003 07 h 35
GMT-04:00, output in Latin1 */

this seems in the spirit of PHP, but i want to know if people can spot
possible drawbacks.

l0t3k

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic