Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93134 invoked by uid 1010); 6 Feb 2007 14:41:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 93119 invoked from network); 6 Feb 2007 14:41:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2007 14:41:32 -0000 Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Linux 2.5 (sometimes 2.4) (4) Received: from [66.11.173.122] ([66.11.173.122:35748] helo=blobule.interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/92-04145-89398C54 for ; Tue, 06 Feb 2007 09:41:31 -0500 Received: by blobule.interjinn.com (Postfix, from userid 2000) id 110535ACF7D; Tue, 6 Feb 2007 09:41:35 -0500 (EST) To: "Ford, Mike" Cc: Brian Moon , internals@lists.php.net In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: InterJinn Date: Tue, 06 Feb 2007 09:41:34 -0500 Message-ID: <1170772895.9567.4.camel@blobule> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Subject: RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array From: robert@interjinn.com (Robert Cummings) On Tue, 2007-02-06 at 14:08 +0000, Ford, Mike wrote: > On 05 February 2007 17:29, Brian Moon wrote: > > That is why you have coding standards. Our doucment states that this > > should be written as: > > > > $a = array( > > 1 => array('pears', 'apples'), > > 2 => array('juice', 'oranges') > > ); > > > > I believe in either syntax, proper formatting of complex data > > can solve > > the readablity problems. > > Solve, no. Alleviate, yes. > > Given the above, the layout tells me there's some kind of structure > going on, but I still have to actually *read* it to discover > that there are arrays involved (and where they start and end). > > With this version: > > $a = [ > 1 => ['pears', 'apples'], > 2 => ['juice', 'oranges'] > ]; > > I can take one glance and tell there are nested arrays involved, and > what their scopes are -- I'd say my comprehension speed is at least > an order of magnitude faster! > > *That* makes this syntax a no-brainer for me, personally ;-) Ummm, you still had to read it. One "glance" just so happens to involve the brain grokking the content, just like reading. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'