RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
-Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: 06 February 2007 16:09 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: Oh, no fair! You've out-pedanted a pedant! And actually I think it's very borderline whether this definition encompasses my experience or not. Regardless, it *still* takes me an order of magnitude longer to comfortably comprehend one notation over the other, whether you call it comprehending, grokking, or just plain reading. And actually, no, I'd rather not be special -- then I wouldn't be irritated by so many everyday things, or spend so much time wondering so many people have so much trouble with so many easy things... ;) Cheers! Mike Mike Ford, Electronic Information Services Adviser, Learning Support Services, JG125, The Library, James Graham Building, Headingley Campus, Beckett Park, LEEDS, LS6 3QS, United Kingdom Tel: +44 113 283 2600 extn 4730Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On 05 February 2007 17:29, Brian Moon wrote: Ford, Mike wrote: I don't find: $a = [1 = ['pears', 'apples'], 2 = ['juice', 'oranges']]; any less readable than: $a = array(1 = array('pears', 'apples'), 2 = array('juice', 'oranges')); Quite the opposite actually :) Me too - I go beyond Edin on this one, as I find the array() version actually quite UNreadable and I have difficulty picking out what the individual arrays are; conversely, the [] version I take in at a glance. 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 ;-) 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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On Tue, 2007-02-06 at 14:08 +, 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. | `' -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On Tue, Feb 06, 2007 at 09:41:34AM -0500, Robert Cummings wrote: On Tue, 2007-02-06 at 14:08 +, 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. I must agree that the [] is easier/quicker to read than array(), but is it really worth it ... too many syntaxes for the same thing ? Anyway: it makes php look like perl -- and that would never do :-) -- Alain Williams Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include std_disclaimer.h -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
Alain Williams wrote: Anyway: it makes php look like perl -- and that would never do :-) Can we please stop that FUD? (even if it is meant as a joke) ... if at all then you might say it looks like Javascript, Python or Ruby. Perl uses an ugly mix of () and [] to emulate multi-dimensional arrays rather unlike the syntax proposed here. Thanks, - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On Tue, Feb 06, 2007 at 04:16:28PM +0100, Christian Schneider wrote: Alain Williams wrote: Anyway: it makes php look like perl -- and that would never do :-) Can we please stop that FUD? (even if it is meant as a joke) No: it was NOT a serious point. What is wrong with the occasional grin ? ... if at all then you might say it looks like Javascript, Python or Ruby. Perl uses an ugly mix of () and [] to emulate multi-dimensional arrays rather unlike the syntax proposed here. Thanks, - Chris -- Alain Williams Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include std_disclaimer.h -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On 06 February 2007 14:42, Robert Cummings wrote: On Tue, 2007-02-06 at 14:08 +, 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! 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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On Tue, 2007-02-06 at 15:41 +, Ford, Mike wrote: On 06 February 2007 14:42, Robert Cummings wrote: On Tue, 2007-02-06 at 14:08 +, 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. | `' -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On 04 February 2007 18:38, Edin Kadribasic wrote: Lukas Kahwe Smith wrote: Yes, you will come across it if its added. I find the Javascript syntax confusing to read as well. However more importantly I do not see the point in adding this sugar to save 5 chars. Nested arrays become very unreadable with the current PHP syntax. I think killing those 5 chars per array would actually make thing more readable. I don't find: $a = [1 = ['pears', 'apples'], 2 = ['juice', 'oranges']]; any less readable than: $a = array(1 = array('pears', 'apples'), 2 = array('juice', 'oranges')); Quite the opposite actually :) Me too - I go beyond Edin on this one, as I find the array() version actually quite UNreadable and I have difficulty picking out what the individual arrays are; conversely, the [] version I take in at a glance. 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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
Steph wrote: On 2/4/07, Ilia Alshanetsky [EMAIL PROTECTED] wrote: I personally find array extremely clear, in recent weeks I had to do A LOT of JavaScript work where the array syntax works in a manner you suggest for PHP and its a massive pain. It does not make for a very clear code. I think the syntax you propose is extremely confusing and we should stick to what we have right now. If someone does not like this new syntax, he can stick to array(). It is in no way an argument to refuse the new syntax addition. And what about maintenance? And what about the confusion for beginners? Yes, you will come across it if its added. I find the Javascript syntax confusing to read as well. However more importantly I do not see the point in adding this sugar to save 5 chars. @Andi: I dont quite understand your formatting argument really. regards, Lukas -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
Lukas Kahwe Smith wrote: Yes, you will come across it if its added. I find the Javascript syntax confusing to read as well. However more importantly I do not see the point in adding this sugar to save 5 chars. Nested arrays become very unreadable with the current PHP syntax. I think killing those 5 chars per array would actually make thing more readable. I don't find: $a = [1 = ['pears', 'apples'], 2 = ['juice', 'oranges']]; any less readable than: $a = array(1 = array('pears', 'apples'), 2 = array('juice', 'oranges')); Quite the opposite actually :) Edin -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On Sun, 4 Feb 2007, Edin Kadribasic wrote: I don't find: $a = [1 = ['pears', 'apples'], 2 = ['juice', 'oranges']]; any less readable than: $a = array(1 = array('pears', 'apples'), 2 = array('juice', 'oranges')); Quite the opposite actually :) That's a personal thing, and I disagree. The array() syntax is clearer. regards, Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
Steph wrote: Hi Stas, By pure coincidence, I was doing a bunch of javascript work lately too, and I find [] syntax OK. From readability POV it's not much difference, but much less clutter if you have really massive data array - no array() things which take half of the space. Fine, but in javascript there is only one option. That's the difference. - Steph a = Array(1,2,3) a = [1,2,3] It's the same as in php ... Regards, Stefan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] [SPAM] Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
Fine, but in javascript there is only one option. That's the difference. - Steph a = Array(1,2,3) a = [1,2,3] I stand corrected. Apologies for the noise. - Steph -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On Sun, 2007-02-04 at 19:38 +0100, Edin Kadribasic wrote: Lukas Kahwe Smith wrote: Yes, you will come across it if its added. I find the Javascript syntax confusing to read as well. However more importantly I do not see the point in adding this sugar to save 5 chars. Nested arrays become very unreadable with the current PHP syntax. I think killing those 5 chars per array would actually make thing more readable. I don't find: $a = [1 = ['pears', 'apples'], 2 = ['juice', 'oranges']]; any less readable than: $a = array(1 = array('pears', 'apples'), 2 = array('juice', 'oranges')); Quite the opposite actually :) Depends on how you format multi-level arrays... $a = array ( 1 = array ( 'pears', 'apples', ), 2 = array ( 'juice', 'organge', ), ); In the new format... $a = [ 1 = [ 'pears', 'apples', ], 2 = [ 'juice', 'organge', ], ]; Can't say that I see a terribly great advantage in readability. -0 :) 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. | `' -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array
On Sun, February 4, 2007 2:46 pm, Stefan Walk wrote: Steph wrote: Hi Stas, By pure coincidence, I was doing a bunch of javascript work lately too, and I find [] syntax OK. From readability POV it's not much difference, but much less clutter if you have really massive data array - no array() things which take half of the space. Fine, but in javascript there is only one option. That's the difference. - Steph a = Array(1,2,3) a = [1,2,3] Apparently I missed the JS tutorial that you could use [1, 2, 3] cuz I always just did it the PHP way... Never been unhappy about it, except when I forget to Capitalize the dang thing... :-) I'm not planning on switching to the other syntax in JS either -- An easy-to-find Caps error beats WTF any day, and to me, not having 'array' there is just a WTF. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php