On Mon, 1 Dec 2003, Stanislav Malyshev wrote:

> DR>> To make it simple to use? I agree with Adam here, with the new
>
> It may make one particular case of use simple. It would make understanding
> even this case complicated, and will complicate a lot of other cases of
> which we didn't think now.

Are we discussing this feature's technical or aesthetic merits? Or both?

> DR>> overloaded objects you can finally do nice things, just like this here.
> DR>> Don't destroy the coolness of this...
>
> What is "coolness"? Ability to write code that uses tricks nobody can
> understand without reading engine sources? I don't think it's cool.

Everyone who I show SimpleXML to automatically understands what's
going on. Having to explicitly write $node->__toString() undoes about
50% of the simplicty in the extension.

Have you ever used the DOM XML? It's so heavyweight that I want to
shoot myself whenever I'm forced to use it. With DOM, I need to write
crap like:

foreach ($dom->getElementsByTagname('person') as $person) {
        list($firstname) = $person->getElementsByTagname('firstname');
        $firstname_text_value = $firstname->firstChild->nodeValue;
}

Compare that to:

foreach($s->person as $person) {
    $firstname_text_value = $person->firstname;
}

You tell me which one "nobody can understand."

SimpleXML -- with the current automagical casting -- is so easy and
intutive that it's probably more useful for the majority of users than
any other feature in PHP 5. Okay. That's an overstatement.

Here's my take. PHP is messy because it tries to make a messy task
like Web programming easy. XML is a key part of Web
programming. SimpleXML is the PHP take on solving XML. I'd prefer for
SimpleXML not to be messy, but that's what we need to do to make using
XML easy.

-adam

-- 
[EMAIL PROTECTED]

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to