On Friday 03 August 2007, adrian rossouw wrote:
On 03 Aug 2007, at 2:28 PM, Jeff Eaton wrote:
Honestly, this straightforward nesting syntax is the only reason that I've felt we should steer away from objects in D6. the use of # to mean 'property' took a log of explaining. Getting rid of that, while maintaining the clean nesting syntax, would be a huge huge win.
Next, I really wish that somewhere down the road php gets named parameters. That would be the fscking awesome. So instead of doing :
$form['title'] = new drupal_textfield(array('title' => 'blah', 'default_value' => blah));
we could do :
$form['title'] = new drupal_textfield(title = 'blah', default_value = 'blah');
Bug the php-internals folks. ;-) One thing that I've been considering lately is that FAPI structure are right now about 90% compatible with SimpleXML. SimpleXML uses ArrayObject, and child objects are referenced with -> while properties are referenced with []. Then you get all sorts of iteration magic with it, the ability to trivially dump to/from XML, etc. That other 10%, though, is array properties. #options is an array, by nature, and therefore can't easily serialize to XML. I don't know if there's a good solution for that. That said, a syntax that somewhat parallels SimpleXML and leverages ArrayObject, iterators, and the rest of SPL, but just doesn't translate directly to XML the way SimpleXML does, could make FAPI a lot cleaner and more intuitive. Oh, so many options... :-) (Go vote for the "Drupal and PHP5" Barcelona presentation that chx and I want to give so we can discuss this in person!) -- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson