Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27860 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33184 invoked by uid 1010); 6 Feb 2007 15:52:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33169 invoked from network); 6 Feb 2007 15:52:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2007 15:52:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=M.Ford@leedsmet.ac.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=M.Ford@leedsmet.ac.uk; sender-id=pass Received-SPF: pass (pb1.pair.com: domain leedsmet.ac.uk designates 160.9.128.17 as permitted sender) X-PHP-List-Original-Sender: M.Ford@leedsmet.ac.uk X-Host-Fingerprint: 160.9.128.17 mrelay-b.lmu.ac.uk Linux 2.4/2.6 Received: from [160.9.128.17] ([160.9.128.17:33421] helo=mrelay-b.lmu.ac.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/72-18465-254A8C54 for ; Tue, 06 Feb 2007 10:52:51 -0500 Received: from localhost.lmu.ac.uk ([127.0.0.1] helo=localhost) by mrelay-b.lmu.ac.uk with esmtp (Exim 4.43) id 1HESVw-0006tH-1H; Tue, 06 Feb 2007 15:45:48 +0000 Received: from mrelay-b.lmu.ac.uk ([127.0.0.1]) by localhost (mrelay-b [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25223-04; Tue, 6 Feb 2007 15:45:44 +0000 (GMT) Received: from leedsmet-exch1.leedsmet.ac.uk ([160.9.35.117]) by mrelay-b.lmu.ac.uk with esmtp (Exim 4.43) id 1HESQu-0006ox-WB; Tue, 06 Feb 2007 15:40:37 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 6 Feb 2007 15:41:38 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array thread-index: AcdJ/Y3Dx56/ngwCSzyRYoYTLnbR5QAAURtg To: "Robert Cummings" Cc: "Brian Moon" , X-Virus-Scanned: by McAfee at Leeds Metropolitan University Subject: RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array From: M.Ford@leedsmet.ac.uk ("Ford, Mike") On 06 February 2007 14:42, Robert Cummings wrote: > 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:=20 > > >=20 > > > $a =3D array( > > > 1 =3D> array('pears', 'apples'), > > > 2 =3D> array('juice', 'oranges') > > > ); > > >=20 > > > I believe in either syntax, proper formatting of complex data can > > > solve the readablity problems. > >=20 > > Solve, no. Alleviate, yes. > >=20 > > 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). > >=20 > > With this version: > >=20 > > $a =3D [ > > 1 =3D> ['pears', 'apples'], > > 2 =3D> ['juice', 'oranges'] > > ]; > >=20 > > 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!=20 > >=20 > > *That* makes this syntax a no-brainer for me, personally ;-) >=20 > Ummm, you still had to read it. One "glance" just so happens to > involve the brain grokking the content, just like reading. No, I didn't have to read it. I had to look at it and see its shape, and I= may or may not have grokked it, but I didn't read it. I still have no ide= a what's actually *in* the arrays, I just know there are arrays and how the= y're structured. My brain, virtually instantaneously, goes, "Oh, brackets, = nested arrays, 2 short arrays nested in an enclosing outer one!". I don't = class that as reading, just visual comprehension. With the long version, my thought process goes more like "Uh, oh, indentati= on, must be some structure here. Can't see any obvious syntactic markers, = just a mush of characters, so better read it. 'array', uh, ok an array, wha= t's in it? explicit index 1 is, oh, 'array' again, ok, so we've got nested = arrays, presumably this line is a self-contained inner array? let's see, 'p= ears', 'apples', and, oh yes, a proper matching close parenthesis; next lin= e similar, explicit index 2, 'juice', 'oranges' and a close parenthesis, yu= p and a proper closing parenthesis for the outer array; right, 2 short arra= ys nested in an outer enclosing one." See how I've actually had to read an= d process *every* *single* *word* *and* *character* on the page? See how m= uch slower it was? Now, that's what I call reading. My brain may be weird and unusual in working this way, but it does so I've = become accustomed to it! I know it's off the norm in other areas (I have n= o problem keeping a dozen or so PINs in my head and reliably producing the = right one without hesitation, and I generally remember personal ID, bank ac= count and credit card numbers without even trying) so it wouldn't surprise = me to find I'm way off the curve here too. Just permit me my little foible= s, eh? Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211=20 To view the terms under which this email is distributed, please go to http:= //disclaimer.leedsmet.ac.uk/email.htm