atom feed111 messages in net.php.lists.internalsRE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Sy...
FromSent OnAttachments
49 earlier messages
Richard LynchFeb 4, 2007 8:54 pm 
Gregory BeaverFeb 4, 2007 9:13 pm 
Brian MoonFeb 4, 2007 11:29 pm 
Antony DovgalFeb 4, 2007 11:47 pm 
Christian SchneiderFeb 5, 2007 2:20 am 
Lukas Kahwe SmithFeb 5, 2007 2:28 am 
Christian SchneiderFeb 5, 2007 2:44 am 
LAUPRETRE François (P)Feb 5, 2007 2:53 am 
ivai...@gmail.comFeb 5, 2007 3:00 am 
Ford, MikeFeb 5, 2007 3:18 am 
Ford, MikeFeb 5, 2007 3:29 am 
Richard QuadlingFeb 5, 2007 4:16 am 
Ford, MikeFeb 5, 2007 4:35 am 
Christian SchneiderFeb 5, 2007 4:54 am 
LAUPRETRE François (P)Feb 5, 2007 5:37 am 
Brian MoonFeb 5, 2007 9:29 am 
Stanislav MalyshevFeb 5, 2007 10:01 am 
Andrei ZmievskiFeb 5, 2007 10:02 am 
Stanislav MalyshevFeb 5, 2007 10:04 am 
Andrei ZmievskiFeb 5, 2007 10:06 am 
Brian MoonFeb 5, 2007 10:16 am 
Stanislav MalyshevFeb 5, 2007 10:24 am 
Todd RuthFeb 5, 2007 10:28 am 
Brian MoonFeb 5, 2007 11:07 am 
Andrei ZmievskiFeb 5, 2007 11:17 am 
Andrei ZmievskiFeb 5, 2007 11:18 am 
Brian MoonFeb 5, 2007 11:32 am 
Robert CummingsFeb 5, 2007 12:28 pm 
Stanislav MalyshevFeb 5, 2007 12:30 pm 
Richard LynchFeb 5, 2007 3:30 pm 
Richard LynchFeb 5, 2007 3:33 pm 
Stanislav MalyshevFeb 5, 2007 3:34 pm 
Richard LynchFeb 5, 2007 3:36 pm 
Richard LynchFeb 5, 2007 3:40 pm 
Richard LynchFeb 5, 2007 3:45 pm 
Richard LynchFeb 5, 2007 3:54 pm 
Mike RobinsonFeb 5, 2007 4:10 pm 
Robert CummingsFeb 5, 2007 4:13 pm 
Sara GolemonFeb 5, 2007 4:20 pm 
Edin KadribasicFeb 5, 2007 4:21 pm 
Ford, MikeFeb 6, 2007 6:07 am 
LAUPRETRE François (P)Feb 6, 2007 6:16 am 
Robert CummingsFeb 6, 2007 6:41 am 
Alain WilliamsFeb 6, 2007 6:46 am 
Christian SchneiderFeb 6, 2007 7:16 am 
Alain WilliamsFeb 6, 2007 7:19 am 
Tullio Andreatta MLFeb 6, 2007 7:29 am 
Ford, MikeFeb 6, 2007 7:41 am 
Lars SchultzFeb 6, 2007 7:47 am 
Robert CummingsFeb 6, 2007 8:09 am 
Andrei ZmievskiFeb 6, 2007 9:26 am 
Andrei ZmievskiFeb 6, 2007 9:27 am 
Andrei ZmievskiFeb 6, 2007 9:27 am 
Richard LynchFeb 6, 2007 6:33 pm 
Richard LynchFeb 6, 2007 6:37 pm 
Richard LynchFeb 6, 2007 6:40 pm 
Ford, MikeFeb 7, 2007 2:20 am 
Ford, MikeFeb 7, 2007 2:31 am 
Mathias BankFeb 8, 2007 2:45 pm 
Hartmut HolzgraefeFeb 8, 2007 2:57 pm 
Brian MoonFeb 8, 2007 3:03 pm 
Vlad BosinceanuFeb 8, 2007 3:25 pm 
Subject:RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
From:Robert Cummings (rob@interjinn.com)
Date:Feb 6, 2007 8:09:01 am
List:net.php.lists.internals

On Tue, 2007-02-06 at 15:41 +0000, Ford, Mike wrote:

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:

$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.

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 idea what's
actually *in* the arrays, I just know there are arrays and how they'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, indentation,
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, what'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, 'pears',
'apples', and, oh yes, a proper matching close parenthesis; next line similar,
explicit index 2, 'juice', 'oranges' and a close parenthesis, yup and a proper
closing parenthesis for the outer array; right, 2 short arrays nested in an
outer enclosing one." See how I've actually had to read and process *every*
*single* *word* *and* *character* on the page? See how much 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 no
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 account 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 foibles, eh?

Cheers!

I know how much you want to feel special, but here's the definition of "read". Your description of how you interpret what you see falls into this definition:

http://209.161.37.11/dictionary/read

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. | `------------------------------------------------------------'