RE: [PHP-DEV] Syntactic improvement to array

2007-02-07 Thread Ford, Mike
> -Original Message-
> From: Richard Lynch [mailto:[EMAIL PROTECTED] 
> Sent: 07 February 2007 02:34
> 
> I was specifically thinking of the sheer number of emails to 
> PHP-General that would result.
> 
> Even if 90% of the newbies "get it" without any research, and 
> 5% more figure it out from context or reading or trying, 
> there's still a heck of a lot who will end up posting.

OK, OK, just to show how big my +1 was in favour of this, I'll
step up and say *I'M* prepared to answer all those questions --
especially as I don't believe it'll actually be anywhere near
as many as you fear.

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

2007-02-07 Thread Ford, Mike
> -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] Syntactic improvement to array

2007-02-06 Thread Richard Lynch
On Tue, February 6, 2007 11:26 am, Andrei Zmievski wrote:
> On Feb 5, 2007, at 3:37 PM, Richard Lynch wrote:
>
>> Yes, and it makes life miserable for some of us...
>>
>> Is that a good reason to extend that misery to yet another operator?
>
> Richard, please. This is not advanced OO stuff or anything close.
> It's an operator. Give PHP users (even newbies) some credit.

I was specifically thinking of the sheer number of emails to
PHP-General that would result.

Even if 90% of the newbies "get it" without any research, and 5% more
figure it out from context or reading or trying, there's still a heck
of a lot who will end up posting.

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



RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array

2007-02-06 Thread Robert Cummings
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] Syntactic improvement to array

2007-02-06 Thread Andrei Zmievski

On Feb 5, 2007, at 3:37 PM, Richard Lynch wrote:


Yes, and it makes life miserable for some of us...

Is that a good reason to extend that misery to yet another operator?


Richard, please. This is not advanced OO stuff or anything close.  
It's an operator. Give PHP users (even newbies) some credit.


-Andrei

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

2007-02-06 Thread Ford, Mike
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] Syntactic improvement to array

2007-02-06 Thread Lars Schultz

Hi.


Our 'newbie' at least has a good chance of figuring out
   $a = [1,2,3]  vs.$a = array(1,2,3)
is different than
   $a = foobar(1,2,3)


I am probably out of my depth here...but I actually find the argument 
about wether to introduce this syntax or not, very entertaining...it's a 
classic example of human individuality. great really;)


The argument against introducing the new syntax, that says, that it's 
less searchable,...well...why not improve the search functionality of 
the php-documentation? it would help with all the other operators (and 
magic functions and language constructs) if the search-function would 
try to match the search-input against operators and constructs, no? I 
know that google won't show anything worthwhile when queried about "php 
[]" or the like...but...the php-documentation is very good and maybe we 
could improve access to it...a newbie could then query all he wants in 
the php-doc page. No good?


Lars

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-06 Thread Tullio Andreatta ML

how it is different? How explaining array written as [] so much harder
that explaining array written as ()? What exactly constitutes the
problem?


Here's the difference:

You can Google for 'array' and learn a lot.

If you try to Google for [] you don't learn squat.

Try it and see.

So our 'newbie' at least has a good chance of figuring out array(1, 2,
3) on their own.  They've got must worse odds of figuring out [1,2,3]


Ok. So I propose more "searcheable" operators:

let($i, 1) === $i = 1
let($d, add($a, $b, $c))   === $d = $a + $b + $c
call(foo, $arg1, $arg2)=== foo($arg1, $arg2)

:-)

Our 'newbie' at least has a good chance of figuring out
   $a = [1,2,3]  vs.$a = array(1,2,3)
is different than
   $a = foobar(1,2,3)

--
Tullio Andreatta

Disclaimer: "Please treat this email message in a reasonable way, or we
might get angry" ( http://www.goldmark.org/jeff/stupid-disclaimers )

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

2007-02-06 Thread Alain Williams
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 

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

2007-02-06 Thread Christian Schneider
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

2007-02-06 Thread Alain Williams
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 

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

2007-02-06 Thread Robert Cummings
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

2007-02-06 Thread Ford, Mike
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] Syntactic improvement to array

2007-02-05 Thread Richard Lynch
On Mon, February 5, 2007 1:18 pm, Andrei Zmievski wrote:
> I don't buy the "searching docs is easier" argument. There are plenty
> of operators and such that are hard to search for.

Yes, and it makes life miserable for some of us...

Is that a good reason to extend that misery to yet another operator?

If the 'array' syntax bugs one that much, write a parser in PHP for
the [] syntax and load the giant arrays with that. :-) :-) :-)

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



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Stanislav Malyshev

Put it this way:  Are you willing to answer EVERY PHP-General question
asking what this is? ;-)

Cuz I'm sure not willing to do it.


I'm not willing to answer newbie questions on regular basis, but that 
has nothing to do with anything - I was unwilling to do it with any 
syntax. I just think inability of the users to comprehend a concept such 
complicated as two brackets put around the array is grossly exaggerated. 
  If you figured out how to use , you can figure out how to use [] ;)


--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Richard Lynch




On Mon, February 5, 2007 12:24 pm, Stanislav Malyshev wrote:
>
>> When a new PHP user asks you "What is an array?" you will
>> understand.
>
> If someone is not familiar with the concept of the array at all, it
> doesn't matter if it's written as array(1,2,3) or [1,2,3]. That's not
> what we are discussing right now.
>
>> Its clear that not all the folks on internals have actually spoken
>> to
>> the masses of users whose first language is PHP.  People don't start
>
> As opposed to you who did, I presume. So, judging from your
> experience,
> how it is different? How explaining array written as [] so much harder
> that explaining array written as ()? What exactly constitutes the
> problem?

Here's the difference:

You can Google for 'array' and learn a lot.

If you try to Google for [] you don't learn squat.

Try it and see.

So our 'newbie' at least has a good chance of figuring out array(1, 2,
3) on their own.  They've got must worse odds of figuring out [1,2,3]

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



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Richard Lynch
On Mon, February 5, 2007 12:01 pm, Stanislav Malyshev wrote:
>> you, they don't have a clue what they are doing.  $a = [1,2,3];
>> would
>> not mean jack sqat to those folks.  And as stated, finding docs on
>> that
>
> How hard can that be? If one is smart enough to do computer
> programming,
> how hard can it be to know $a=[1,2,3] is an array? Like, what else
> could
> it be?

Looks like a syntax error to me. :-v

I wouldn't know if it was an array or something entirely new.

Could be a random selection from those choices.

Might be an ordered set, though I suppose in PHP that has to be an
array anyway, at least today.

Put it this way:  Are you willing to answer EVERY PHP-General question
asking what this is? ;-)

Cuz I'm sure not willing to do it.

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



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Stanislav Malyshev



$a = array( 1, 2, 3 ).



It's not hard. I don't think anybody ever argued it's hard to 
understand. The argument was it's too verbose once you talk about 
multi-dimensional arrays with a lot of sub-arrays containing in turn 
even more sub-arrays - entire code becomes packed with repetitions of 
"array" word.

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Robert Cummings
On Mon, 2007-02-05 at 10:01 -0800, Stanislav Malyshev wrote:
> > you, they don't have a clue what they are doing.  $a = [1,2,3]; would 
> > not mean jack sqat to those folks.  And as stated, finding docs on that 
> 
> How hard can that be? If one is smart enough to do computer programming, 
> how hard can it be to know $a=[1,2,3] is an array? Like, what else could 
> it be?

The same argument can be made about how hard it is to understand

$a = array( 1, 2, 3 ).

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] Syntactic improvement to array

2007-02-05 Thread Brian Moon

Andrei Zmievski wrote:
I don't buy the "searching docs is easier" argument. There are plenty of 
operators and such that are hard to search for.


Good point, but, were there pre-existing solutions to those operators 
when they were created?  I think that is the point that Zeev was making. 
 We have a way to do this that is 95% the same as this new method.  If 
this was a new language construct the discussion would be totally different.


--

Brian Moon
-
http://dealnews.com/
It's good to be cheap =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Andrei Zmievski
I don't buy the "searching docs is easier" argument. There are plenty 
of operators and such that are hard to search for.


-Andrei

On Feb 5, 2007, at 11:07 AM, Brian Moon wrote:

If someone is not familiar with the concept of the array at all, it 
doesn't matter if it's written as array(1,2,3) or [1,2,3]. That's not 
what we are discussing right now.


My point is that if its written array(1,2,3) that have something to 
search for in the docs.  The new proposed syntax removes that keyword 
that a user can use to find the help they need.  As I said, back 
ticks, as well as ternary, both suffer from this problem.  I see no 
reason to add another hurdle for new users when there is no clear 
advantage to this new syntax.  And, IMO, clear means that a majority 
of people think its a no brainer.  I would say right now we have 
nothing of the sort.


--

Brian Moon
-
http://dealnews.com/
It's good to be cheap =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Brian Moon
If someone is not familiar with the concept of the array at all, it 
doesn't matter if it's written as array(1,2,3) or [1,2,3]. That's not 
what we are discussing right now.


My point is that if its written array(1,2,3) that have something to 
search for in the docs.  The new proposed syntax removes that keyword 
that a user can use to find the help they need.  As I said, back ticks, 
as well as ternary, both suffer from this problem.  I see no reason to 
add another hurdle for new users when there is no clear advantage to 
this new syntax.  And, IMO, clear means that a majority of people think 
its a no brainer.  I would say right now we have nothing of the sort.


--

Brian Moon
-
http://dealnews.com/
It's good to be cheap =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Stanislav Malyshev


When a new PHP user asks you "What is an array?" you will understand. 


If someone is not familiar with the concept of the array at all, it 
doesn't matter if it's written as array(1,2,3) or [1,2,3]. That's not 
what we are discussing right now.


Its clear that not all the folks on internals have actually spoken to 
the masses of users whose first language is PHP.  People don't start 


As opposed to you who did, I presume. So, judging from your experience, 
how it is different? How explaining array written as [] so much harder 
that explaining array written as ()? What exactly constitutes the problem?

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Brian Moon

Stanislav Malyshev wrote:
you, they don't have a clue what they are doing.  $a = [1,2,3]; would 
not mean jack sqat to those folks.  And as stated, finding docs on that 


How hard can that be? If one is smart enough to do computer programming, 
how hard can it be to know $a=[1,2,3] is an array? Like, what else could 
it be?




When a new PHP user asks you "What is an array?" you will understand. 
Its clear that not all the folks on internals have actually spoken to 
the masses of users whose first language is PHP.  People don't start 
with BASIC and Pascal anymore.  That is why it has gotten so popular. 
Someone who has never programmed before can pick it up and start hacking.


Don't even try explaining a ternary to them. =)

--

Brian Moon
-
http://dealnews.com/
It's good to be cheap =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Stanislav Malyshev
you, they don't have a clue what they are doing.  $a = [1,2,3]; would 
not mean jack sqat to those folks.  And as stated, finding docs on that 


How hard can that be? If one is smart enough to do computer programming, 
how hard can it be to know $a=[1,2,3] is an array? Like, what else could 
it be?


--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Andrei Zmievski

I agree. Syntax is good, if we make it work both ways.

-Andrei

On Feb 4, 2007, at 8:59 AM, Zeev Suraski wrote:

My 2c - unless we also make it behave like a list() when in assignment 
context - I think it will confusing.


So I'm +1 if we make it work as both list() and array(), and -1 
otherwise.


Zeev

At 09:25 04-02-07, Andi Gutmans wrote:

Hi,

I thought I may have brought this up a long time ago but couldn't 
find anything in the archives.
For a long time already I've been thinking about possibly adding a 
new syntax for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way to 
do things, I think it'd look much more elegant especially (but

not only) for nested arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as 
it's not desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue but 
I'd have to dive a bit deeper.


Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


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

2007-02-05 Thread Brian Moon

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.


--

Brian Moon
-
http://dealnews.com/
It's good to be cheap =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] Syntactic improvement to array

2007-02-05 Thread Ford, Mike
On 04 February 2007 21:41, Zeev Suraski wrote:

> At 23:27 04-02-07, Pierre wrote:
> > On 2/4/07, Zeev Suraski <[EMAIL PROTECTED]> wrote:
> > > At 20:14 04-02-07, Pierre wrote:
> > > > Hi,
> > > > 
> > > > 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. 
> > > 
> > > We never believed in that approach and we're not about to start
> > > now :). 
> > 
> > What I mean is that the new syntax does not any drawback besides
> > hurting a couple of people eyes (I'm pretty sure that most of our
> > users will like it). The changes have no effect on how your scripts
> > will run, not like the numerous changes we applied in 5.x until now.
> 
> One of the key guidelines of the language definition process of PHP
> was that we don't want multiple ways of doing the same thing, and we
> don't buy the argument of 'why do you care?  you can still do it the
> other way'.  Only if the new way is significantly better than the old
> way of doing things (i.e. much faster / much simpler, etc.) we
> consider it.  I think it's been a very good guideline and helped us a
> lot in keeping PHP relatively clean for a very long time.

I hadn't come across this as a stated PHP principle, and I actually
don't buy it either in respect of PHP[*] or in general.  It's often the
case, as is becoming clear with this, that different people have widely
divergent views about what is clear and easy to use/read and what isn't,
and providing alternatives that suit both camps is to me a very positive
move -- you'd end up pleasing far more people far more of the time than
by sticking rigidly to the original option.

[*] I enter into evidence here the alternative ":" block structure,
which dates back further than I care to delve (but am extremely glad
of); many function (or language construct) aliases, such as print/echo,
exit/die; foreach in place of reset()/each(); 3 different ways (soon to
be 4) to write a string literal; and even the inclusion of string
slicing using (ironically) a [:] syntax on the PHP 6 feature list.

> The new array syntax is arguably clearer (although some here
> disagree).  It's not MUCH clearer to the sense that it's a no
> brainer, which makes things more complicated.

In your opinion.  Personally, I find the [] syntax so much clearer that
I would rate it a no-brainer to include it.  But, by the same token,
there are also people on here who would rate it a no-brainer *not* to
include it.

Finally, I really don't see the argument that the [] syntax is non-
obvious. If you're working with arrays at all, you have to know that
[] is used to subscript out individual elements, so it seems to me
abundantly clear that other uses of [] are most likely to be array-
related and a quick step to the Arrays section of the manual would be
in order.

OK, as a mere enthusiastic user I've probably said more than I am
entitled to, so I'll disappear for now...!!

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

2007-02-05 Thread Ford, Mike
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] Syntactic improvement to array

2007-02-05 Thread Ford, Mike
On 04 February 2007 07:25, Andi Gutmans wrote:

> Hi,
> 
> I thought I may have brought this up a long time ago but
> couldn't find anything in the archives.
> For a long time already I've been thinking about possibly
> adding a new syntax for array(...) which would be shorter. I'd suggest
> [...]. While I am usually not in favor of having more than
> one way to do things, I think it'd look much more elegant
> especially (but
> not only) for nested arrays.
> 
> So what I'm thinking of is:
> array(1, 2, 3) == [1, 2, 3]
> array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
> array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]
> 
> $arr = [1, 2, 3]
> vs.
> $arr = array(1, 2, 3)
> 
> Well enough examples given :)
> I think it's not worth doing unless there's overwhelming
> support as it's not desperately needed. But I'd be interested to hear
> people's thoughts. It seems implementation shouldn't be an
> issue but I'd have to dive a bit deeper.

Overwhelming support from here ;-D

Seriously, I personally find the [...] syntax really elegant and
intuitive, and the array(...) syntax really hard to read and
obfuscating.

A BIG +1

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] Syntactic improvement to array

2007-02-04 Thread Antony Dovgal

On 02/04/2007 10:25 AM, Andi Gutmans wrote:

Hi,

I thought I may have brought this up a long time ago but couldn't find anything 
in the archives.
For a long time already I've been thinking about possibly adding a new syntax 
for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way to do 
things, I think it'd look much more elegant especially (but
not only) for nested arrays.


It doesn't look more elegant to me.
-1 


--
Wbr, 
Antony Dovgal


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Brian Moon

phpxcache wrote:

most ppl who works on web pages have to know what javascript

> is, so there isn't any difficulty for ppl to get used ...

You give brand new PHP hackers too much credit.  Sure professional PHP 
developers do have to work with Javascript.  But, working on Phorum and 
see real users who are trying to hack their way around PHP, I can tell 
you, they don't have a clue what they are doing.  $a = [1,2,3]; would 
not mean jack sqat to those folks.  And as stated, finding docs on that 
syntax would not be easy.  I tried finding the docs on the back tick 
syntax the other day and had a hard time.  And I know what it does.  I 
finally had to go look up exec() and hope some good doc writer (thanks, 
whoever that was) had linked the back tick syntax there.


-1 for confusing new PHP users.

--

Brian Moon
-
http://dealnews.com/
It's good to be cheap =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Richard Lynch
On Sun, February 4, 2007 7:53 am, Hannes Magnusson wrote:
> On 2/4/07, Nico Haase <[EMAIL PROTECTED]> wrote:
>> Hallöchen,
>> *Johannes Schlüter* schrub:
>> >  - Without keyword it's hard to find the documentation if you
>> don't know
>> >that syntax
>>
>> Well, this is the same with HEREDOC since you can use any delimiter.
>
> http://php.net/<<<

I'm pretty sure the Dev Team could manage to make these work:
http://php.net/[
http://php.net/[]
as well.

That presumes a user is brave enough to try to USE that URL.

There's not much we can do about email clients refusing to make that
bogus URL actually work as a hot link, however...

Yes -- I did just argue against my own position, but I'd rather have
valid arguments than hurt PHP.

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



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Richard Lynch
On Sun, February 4, 2007 8:58 am, Christian Schneider wrote:
> Plus you could
> still
> use array() if you really wanted to.

Yes, but sooner or later I am stuck with somebody else's code who
decided to write the non-array version, and I'm sitting there
wondering what [bleep] this code is doing.

This argument really never holds water.

I don't find that dropping 5 characters increases readability to any
large degree.

If readability of a complex structure is of paramount importance,
proper newlines and indentation are going to be required anyway, and
the 'array' bit is not relevant.

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



Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Richard Lynch
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



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Richard Lynch
On Sun, February 4, 2007 10:59 am, Zeev Suraski wrote:
> My 2c - unless we also make it behave like a list() when in
> assignment context - I think it will confusing.
>
> So I'm +1 if we make it work as both list() and array(), and -1
> otherwise.

Can you show by example what this means?

I'm seeing several different things in my head...

I don't like any of them, either. :-v

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



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Richard Lynch
On Sun, February 4, 2007 1:25 am, Andi Gutmans wrote:
> I thought I may have brought this up a long time ago but couldn't find
> anything in the archives.
> For a long time already I've been thinking about possibly adding a new
> syntax for array(...) which would be shorter. I'd suggest
> [...]. While I am usually not in favor of having more than one way to
> do things, I think it'd look much more elegant especially (but
> not only) for nested arrays.
>
> So what I'm thinking of is:
> array(1, 2, 3) == [1, 2, 3]
> array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
> array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]
>
> $arr = [1, 2, 3]
> vs.
> $arr = array(1, 2, 3)
>
> Well enough examples given :)
> I think it's not worth doing unless there's overwhelming support as
> it's not desperately needed. But I'd be interested to hear
> people's thoughts. It seems implementation shouldn't be an issue but
> I'd have to dive a bit deeper.

I somewhat prefer seeing 'array' there so I know what the [bleep] is
going on, personally.

-0.3

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



Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Robert Cummings
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] Syntactic improvement to array

2007-02-04 Thread Pierre

On 2/4/07, Zeev Suraski <[EMAIL PROTECTED]> wrote:

At 23:51 04-02-07, Pierre wrote:
>On 2/4/07, Zeev Suraski <[EMAIL PROTECTED]> wrote:
>
>>One of the key guidelines of the language definition process of PHP
>>was that we don't want multiple ways of doing the same thing, and we
>>don't buy the argument of 'why do you care?  you can still do it the
>>other way'.
>
>We already have many ways to do the same tasks.

I would argue that we don't compared to other languages of PHP's
age.  Either way it doesn't matter - it's still a guideline we should stick to.

To make it clear, the main thing I opposed is not the new idea (I
stated my opinion separately), but the notion of "you don't have to
use the new syntax so why should you care", which simply doesn't cut
it with PHP.


It was badly said and did not reflect my thoughts correctly, I
hopefully made it  clearer now :)

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Zeev Suraski

At 23:51 04-02-07, Pierre wrote:

On 2/4/07, Zeev Suraski <[EMAIL PROTECTED]> wrote:


One of the key guidelines of the language definition process of PHP
was that we don't want multiple ways of doing the same thing, and we
don't buy the argument of 'why do you care?  you can still do it the
other way'.


We already have many ways to do the same tasks.


I would argue that we don't compared to other languages of PHP's 
age.  Either way it doesn't matter - it's still a guideline we should stick to.


To make it clear, the main thing I opposed is not the new idea (I 
stated my opinion separately), but the notion of "you don't have to 
use the new syntax so why should you care", which simply doesn't cut 
it with PHP.


Zeev 


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Pierre

On 2/4/07, Zeev Suraski <[EMAIL PROTECTED]> wrote:


One of the key guidelines of the language definition process of PHP
was that we don't want multiple ways of doing the same thing, and we
don't buy the argument of 'why do you care?  you can still do it the
other way'.


We already have many ways to do the same tasks. It is getting even
worst as even some bugs require to use the other way to solve the
problem (like with arrays and __get/__set, it sometimes requires to
use ArrayObect and we even introduce a kind of breakage in 5.2.x...).


Only if the new way is significantly better than the old
way of doing things (i.e. much faster / much simpler, etc.) we
consider it.  I think it's been a very good guideline and helped us a
lot in keeping PHP relatively clean for a very long time.


It should have yes. And for most situations it did. But here we are
talking about something asked since years and always rejected with the
same arguments, despite a clear support from the community. We should
organize a poll somewhere, I will be surprised to see a negative
result.


I think we can live w/o it like we did in the last decade, but I feel
strongly about not introducing it unless we also support [] as a
replacement for list().  If [] works for arrays people would expect
it to work for lists too.  I guess my more accurate vote for that
option would be +0 (and -1 in case it's only a replacement for array()).


It is impossible (holy BC) to replace array(), no question here  :)

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Zeev Suraski

At 23:27 04-02-07, Pierre wrote:

On 2/4/07, Zeev Suraski <[EMAIL PROTECTED]> wrote:

At 20:14 04-02-07, Pierre wrote:
>Hi,
>
>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.

We never believed in that approach and we're not about to start now :).


What I mean is that the new syntax does not any drawback besides
hurting a couple of people eyes (I'm pretty sure that most of our
users will like it). The changes have no effect on how your scripts
will run, not like the numerous changes we applied in 5.x until now.


One of the key guidelines of the language definition process of PHP 
was that we don't want multiple ways of doing the same thing, and we 
don't buy the argument of 'why do you care?  you can still do it the 
other way'.  Only if the new way is significantly better than the old 
way of doing things (i.e. much faster / much simpler, etc.) we 
consider it.  I think it's been a very good guideline and helped us a 
lot in keeping PHP relatively clean for a very long time.


The new array syntax is arguably clearer (although some here 
disagree).  It's not MUCH clearer to the sense that it's a no 
brainer, which makes things more complicated.


I think we can live w/o it like we did in the last decade, but I feel 
strongly about not introducing it unless we also support [] as a 
replacement for list().  If [] works for arrays people would expect 
it to work for lists too.  I guess my more accurate vote for that 
option would be +0 (and -1 in case it's only a replacement for array()).


Zeev

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Pierre

On 2/4/07, Zeev Suraski <[EMAIL PROTECTED]> wrote:

At 20:14 04-02-07, Pierre wrote:
>Hi,
>
>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.

We never believed in that approach and we're not about to start now :).


What I mean is that the new syntax does not any drawback besides
hurting a couple of people eyes (I'm pretty sure that most of our
users will like it). The changes have no effect on how your scripts
will run, not like the numerous changes we applied in 5.x until now.

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Zeev Suraski

At 20:14 04-02-07, Pierre wrote:

Hi,

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.


We never believed in that approach and we're not about to start now :).

Zeev 


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

2007-02-04 Thread Steph

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

2007-02-04 Thread Stefan Walk
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] Syntactic improvement to array

2007-02-04 Thread Steph

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



--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Stanislav Malyshev
IA>>I personally find array extremely clear, in recent weeks I had to do A 
IA>>LOT of JavaScript work where the array syntax works in a manner you 
IA>>suggest for PHP and its a massive pain. It does not make for a very 

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.

-- 
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Marcus Boerger
Hello Pierre,

  as much as you are true we never accepted the argument that some simply
can skip a certain syntax or feature.

best regards
marcus

Sunday, February 4, 2007, 7:14:19 PM, you wrote:

> Hi,

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

> --Pierre




Best regards,
 Marcus

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

2007-02-04 Thread Derick Rethans
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] Syntactic improvement to array

2007-02-04 Thread Derick Rethans
On Sat, 3 Feb 2007, Andi Gutmans wrote:

> I thought I may have brought this up a long time ago but couldn't find 
> anything in the archives. For a long time already I've been thinking 
> about possibly adding a new syntax for array(...) which would be 
> shorter. I'd suggest [...]. While I am usually not in favor of having 
> more than one way to do things, I think it'd look much more elegant 
> especially (but not only) for nested arrays.
> 
> So what I'm thinking of is:
> array(1, 2, 3) == [1, 2, 3]
> array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
> array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]
> 
> $arr = [1, 2, 3]
> vs.
> $arr = array(1, 2, 3)
> 
> Well enough examples given :) I think it's not worth doing unless 
> there's overwhelming support as it's not desperately needed. But I'd 
> be interested to hear people's thoughts. It seems implementation 
> shouldn't be an issue but I'd have to dive a bit deeper.

That gets a big -1 from me, unless you misposed this mail and it should 
have ended up on [EMAIL PROTECTED] or something ;-)

regards,
Derick

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Pierre

On 2/4/07, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote:

On 4-Feb-07, at 1:14 PM, Pierre 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.

If you want to make PHP into Perl that's a fine goal I suppose,
however that's not something I want to participate in.


That's also hardly an argument as all modern languages support this
syntax as wel as an array-like one (in one form or another, using
constructors, initializer or special ops).

The argument "if you like to make PHP into " is getting old. We argue about OO and PHP using the same one,
goto is also such a victim  (the spaghetti code FUD).

This syntax has been asked hundred times in the past and we kept find
all possible excuses to ignore these requests.  I think we will make a
mistake if we ignore it once again.

No more cent for this thread :)

--Pierre

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

2007-02-04 Thread Edin Kadribasic
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] Syntactic improvement to array

2007-02-04 Thread Lukas Kahwe Smith

Ilia Alshanetsky wrote:

On 4-Feb-07, at 1:14 PM, Pierre 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.


If you want to make PHP into Perl that's a fine goal I suppose, however 
that's not something I want to participate in.


For what its worth, I dont really see a good reason for this addition. 
But its also not something I feel so strongly about that I really think 
its critical. I am much more concerned about adding fatal errors for OO 
strictness violations (ups .. i am about to high jack the thread to 
bring up E_DEPRECATED again).


regards,
Lukas

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Ilia Alshanetsky

On 4-Feb-07, at 1:14 PM, Pierre 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.


If you want to make PHP into Perl that's a fine goal I suppose,  
however that's not something I want to participate in.


Ilia Alshanetsky

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Mike Robinson
Pierre 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.

I agree sir.

It's a nice little addition - all the better if it isn't too much
work to implement and someone has already volunteered to do it.  :)

Best Regards

Mike Robinson

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

2007-02-04 Thread Lukas Kahwe Smith

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



[PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Steph

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?

- Steph

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Steph
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.


FWIW, I'm with Ilia on this; I find it confusing too. There's been the same 
syntax in PHP since the earliest days, why add another way to write it now? 
Is there some material benefit, e.g. would it make it easier to work with 
some third-party thing such as XML?



On 4-Feb-07, at 12:39 PM, Andi Gutmans wrote:

I think it's actually more readable especially for people coming  from 
other languages.
I've always found the array() syntax not quite as readable as other 
languages because it allows for less structuring esp. with
nesting. I actually find it harder to digest despite it being more 
verbose (which in most cases is not the case).
It's definitely not about saving letters. I never favor saving  typing 
unless there's a good reason. In this case I think it's just a

better syntax which we should have used from day 1.

Andi


-Original Message-
From: Ilia Alshanetsky [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 04, 2007 9:28 AM
To: Andi Gutmans
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] Syntactic improvement to array

I have to second Marcus on this, this new syntax makes things
harder to read. I mean what are you saving here, a few letter?

Ilia


On 4-Feb-07, at 2:25 AM, Andi Gutmans wrote:


Hi,

I thought I may have brought this up a long time ago but

couldn't find

anything in the archives.
For a long time already I've been thinking about possibly

adding a new

syntax for array(...) which would be shorter. I'd suggest

[...]. While

I am usually not in favor of having more than one way to do

things, I

think it'd look much more elegant especially (but not only)

for nested

arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]

array("key"

=> 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as
it's not desperately needed. But I'd be interested to hear people's
thoughts. It seems implementation shouldn't be an issue but

I'd have

to dive a bit deeper.

Andi

--
PHP Internals - PHP Runtime Development Mailing List To

unsubscribe,

visit: http://www.php.net/unsub.php



Ilia Alshanetsky








Ilia Alshanetsky

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Pierre

Hi,

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.

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Ilia Alshanetsky
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.



On 4-Feb-07, at 12:39 PM, Andi Gutmans wrote:

I think it's actually more readable especially for people coming  
from other languages.
I've always found the array() syntax not quite as readable as other  
languages because it allows for less structuring esp. with
nesting. I actually find it harder to digest despite it being more  
verbose (which in most cases is not the case).
It's definitely not about saving letters. I never favor saving  
typing unless there's a good reason. In this case I think it's just a

better syntax which we should have used from day 1.

Andi


-Original Message-
From: Ilia Alshanetsky [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 04, 2007 9:28 AM
To: Andi Gutmans
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] Syntactic improvement to array

I have to second Marcus on this, this new syntax makes things
harder to read. I mean what are you saving here, a few letter?

Ilia


On 4-Feb-07, at 2:25 AM, Andi Gutmans wrote:


Hi,

I thought I may have brought this up a long time ago but

couldn't find

anything in the archives.
For a long time already I've been thinking about possibly

adding a new

syntax for array(...) which would be shorter. I'd suggest

[...]. While

I am usually not in favor of having more than one way to do

things, I

think it'd look much more elegant especially (but not only)

for nested

arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]

array("key"

=> 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as
it's not desperately needed. But I'd be interested to hear people's
thoughts. It seems implementation shouldn't be an issue but

I'd have

to dive a bit deeper.

Andi

--
PHP Internals - PHP Runtime Development Mailing List To

unsubscribe,

visit: http://www.php.net/unsub.php



Ilia Alshanetsky








Ilia Alshanetsky

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Andi Gutmans
I think it's actually more readable especially for people coming from other 
languages.
I've always found the array() syntax not quite as readable as other languages 
because it allows for less structuring esp. with
nesting. I actually find it harder to digest despite it being more verbose 
(which in most cases is not the case).
It's definitely not about saving letters. I never favor saving typing unless 
there's a good reason. In this case I think it's just a
better syntax which we should have used from day 1.

Andi 

> -Original Message-
> From: Ilia Alshanetsky [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, February 04, 2007 9:28 AM
> To: Andi Gutmans
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] Syntactic improvement to array
> 
> I have to second Marcus on this, this new syntax makes things 
> harder to read. I mean what are you saving here, a few letter?
> 
> Ilia
> 
> 
> On 4-Feb-07, at 2:25 AM, Andi Gutmans wrote:
> 
> > Hi,
> >
> > I thought I may have brought this up a long time ago but 
> couldn't find 
> > anything in the archives.
> > For a long time already I've been thinking about possibly 
> adding a new 
> > syntax for array(...) which would be shorter. I'd suggest 
> [...]. While 
> > I am usually not in favor of having more than one way to do 
> things, I 
> > think it'd look much more elegant especially (but not only) 
> for nested 
> > arrays.
> >
> > So what I'm thinking of is:
> > array(1, 2, 3) == [1, 2, 3]
> > array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]] 
> array("key" 
> > => 1, "key2" => 2) == ["key" => 1, "key2" => 2]
> >
> > $arr = [1, 2, 3]
> > vs.
> > $arr = array(1, 2, 3)
> >
> > Well enough examples given :)
> > I think it's not worth doing unless there's overwhelming support as 
> > it's not desperately needed. But I'd be interested to hear people's 
> > thoughts. It seems implementation shouldn't be an issue but 
> I'd have 
> > to dive a bit deeper.
> >
> > Andi
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List To 
> unsubscribe, 
> > visit: http://www.php.net/unsub.php
> >
> 
> Ilia Alshanetsky
> 
> 
> 
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Ilia Alshanetsky
I have to second Marcus on this, this new syntax makes things harder  
to read. I mean what are you saving here, a few letter?


Ilia


On 4-Feb-07, at 2:25 AM, Andi Gutmans wrote:


Hi,

I thought I may have brought this up a long time ago but couldn't  
find anything in the archives.
For a long time already I've been thinking about possibly adding a  
new syntax for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way  
to do things, I think it'd look much more elegant especially (but

not only) for nested arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as  
it's not desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue  
but I'd have to dive a bit deeper.


Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Ilia Alshanetsky

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Zeev Suraski
My 2c - unless we also make it behave like a list() when in 
assignment context - I think it will confusing.


So I'm +1 if we make it work as both list() and array(), and -1 otherwise.

Zeev

At 09:25 04-02-07, Andi Gutmans wrote:

Hi,

I thought I may have brought this up a long time ago but couldn't 
find anything in the archives.
For a long time already I've been thinking about possibly adding a 
new syntax for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way 
to do things, I think it'd look much more elegant especially (but

not only) for nested arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as 
it's not desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue but 
I'd have to dive a bit deeper.


Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Rasmus Lerdorf
Marcus Boerger wrote:
>   it is a bit harder to read and not the php way imo.

The PHP way is to steal and borrow from other languages whenever
possible to produce a syntax that is clear and understandable to people
doing web development.

What is clear and understandable to web developers is a moving target.
As someone mentioned, nobody who does any sort of web development today
can ignore Javascript and they will typically be switching back and
forth between Javascript and PHP every couple of minutes.  This is our
target user these days and as such this syntax is appropriate I think.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Lukas Kahwe Smith

Marcus Boerger wrote:

Hello Andi,

  it is a bit harder to read and not the php way imo.


I agree with Marcus.

regards,
Lukas

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Andi Gutmans
Yep. I should have finished reading my messages first :) 

> -Original Message-
> From: Pierre [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, February 04, 2007 7:24 AM
> To: Hannes Magnusson
> Cc: Andi Gutmans; internals@lists.php.net
> Subject: Re: [PHP-DEV] Syntactic improvement to array
> 
> On 2/4/07, Hannes Magnusson <[EMAIL PROTECTED]> wrote:
> > Hi Andi
> >
> > function typeHinted([] $array = []) { // type hint array, 
> default to 
> > empty one
> 
> That's a wrong example.
> 
> Type hinting should still rely on the literal name:
> 
> function typeHinted(Array $myarray=[])
> 
> --Pierre
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Andi Gutmans
I would definitely not advocate to use [] in a type hint. For the same reason 
you don't use array() but array :)
It'd be:
function typeHinted(array $array = []) {
...
}

I don't see any issue with that. I'm talking about the construct that allows 
you to create an array.
Andi 

> -Original Message-
> From: Hannes Magnusson [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, February 04, 2007 6:30 AM
> To: Andi Gutmans
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] Syntactic improvement to array
> 
> Hi Andi
> 
> function typeHinted([] $array = []) { // type hint array, 
> default to empty one
> if(count($array)) {
> array_merge($array, ["foo" => []]); // merge $array 
> with array("foo" => array());
> return $array;
> }
> return []; // empty array
> }
> 
> typeHinted([1 => [1 => []]]); // array(1 => array(1 => array()));
> 
> -1 from me
> 
> -Hannes
> 
> On 2/4/07, Andi Gutmans <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I thought I may have brought this up a long time ago but 
> couldn't find anything in the archives.
> > For a long time already I've been thinking about possibly 
> adding a new 
> > syntax for array(...) which would be shorter. I'd suggest 
> [...]. While 
> > I am usually not in favor of having more than one way to do 
> things, I think it'd look much more elegant especially (but 
> not only) for nested arrays.
> >
> > So what I'm thinking of is:
> > array(1, 2, 3) == [1, 2, 3]
> > array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]] 
> array("key" 
> > => 1, "key2" => 2) == ["key" => 1, "key2" => 2]
> >
> > $arr = [1, 2, 3]
> > vs.
> > $arr = array(1, 2, 3)
> >
> > Well enough examples given :)
> > I think it's not worth doing unless there's overwhelming support as 
> > it's not desperately needed. But I'd be interested to hear 
> people's thoughts. It seems implementation shouldn't be an 
> issue but I'd have to dive a bit deeper.
> >
> > Andi
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List To 
> unsubscribe, 
> > visit: http://www.php.net/unsub.php
> >
> >
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Pierre

On 2/4/07, Hannes Magnusson <[EMAIL PROTECTED]> wrote:

Hi Andi

function typeHinted([] $array = []) { // type hint array, default to empty one


That's a wrong example.

Type hinting should still rely on the literal name:

function typeHinted(Array $myarray=[])

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Christian Schneider

Hannes Magnusson wrote:

typeHinted([1 => [1 => []]]); // array(1 => array(1 => array()));


IMHO the common case would benefit and your pathological example is 
unreadable both ways. Personally I'd reformat it to


typeHinted([
1 => [
1 => []
]
]);

resp.

typeHinted(array(
1 => array(
1 => array(),
)
));

or something similar anyway to make them readable. Plus you could still 
use array() if you really wanted to.


Regards,
- Chris

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Hannes Magnusson

Hi Andi

function typeHinted([] $array = []) { // type hint array, default to empty one
   if(count($array)) {
   array_merge($array, ["foo" => []]); // merge $array with
array("foo" => array());
   return $array;
   }
   return []; // empty array
}

typeHinted([1 => [1 => []]]); // array(1 => array(1 => array()));

-1 from me

-Hannes

On 2/4/07, Andi Gutmans <[EMAIL PROTECTED]> wrote:

Hi,

I thought I may have brought this up a long time ago but couldn't find anything 
in the archives.
For a long time already I've been thinking about possibly adding a new syntax 
for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way to do 
things, I think it'd look much more elegant especially (but
not only) for nested arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as it's not 
desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue but I'd have 
to dive a bit deeper.

Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Hannes Magnusson

On 2/4/07, Nico Haase <[EMAIL PROTECTED]> wrote:

Hallöchen,
*Johannes Schlüter* schrub:
>  - Without keyword it's hard to find the documentation if you don't know
>that syntax

Well, this is the same with HEREDOC since you can use any delimiter.


http://php.net/<<<

-Hannes


And this new array-syntax should not replace the old one, but extend
it, so everyone who wants to be able to read his code, can use array()
furthermore.
Nico

--
www.buchtips.net - Rezensionen online

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Nico Haase
Hallöchen,
*Johannes Schlüter* schrub:
>  - Without keyword it's hard to find the documentation if you don't know
>that syntax

Well, this is the same with HEREDOC since you can use any delimiter.
And this new array-syntax should not replace the old one, but extend
it, so everyone who wants to be able to read his code, can use array()
furthermore.
Nico

-- 
www.buchtips.net - Rezensionen online

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Johannes Schlüter
Hi Andi,

I'd like such a syntax enhancement.

These should be the results from the last time the issue was discussed:
http://devzone.zend.com/node/view/id/1474#Heading7

If I remember correct the main issues stated against it were
 - it's to perlish
 - Without keyword it's hard to find the documentation if you don't know
   that syntax

But I would still like having it :-)

johannes

On Sat, 2007-02-03 at 23:25 -0800, Andi Gutmans wrote:
> Hi,
> 
> I thought I may have brought this up a long time ago but couldn't find 
> anything in the archives.
> For a long time already I've been thinking about possibly adding a new syntax 
> for array(...) which would be shorter. I'd suggest
> [...]. While I am usually not in favor of having more than one way to do 
> things, I think it'd look much more elegant especially (but
> not only) for nested arrays.
> 
> So what I'm thinking of is:
> array(1, 2, 3) == [1, 2, 3]
> array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
> array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]
> 
> $arr = [1, 2, 3]
> vs.
> $arr = array(1, 2, 3)
> 
> Well enough examples given :)
> I think it's not worth doing unless there's overwhelming support as it's not 
> desperately needed. But I'd be interested to hear
> people's thoughts. It seems implementation shouldn't be an issue but I'd have 
> to dive a bit deeper.
> 
> Andi
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Edin Kadribasic

I like it :)
+1

Edin

On Feb 4, 2007, at 8:25, Andi Gutmans wrote:


Hi,

I thought I may have brought this up a long time ago but couldn't find 
anything in the archives.
For a long time already I've been thinking about possibly adding a new 
syntax for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way to 
do things, I think it'd look much more elegant especially (but

not only) for nested arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as 
it's not desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue but 
I'd have to dive a bit deeper.


Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php




--
Edin Kadribasic, Emini A/S
Symbion Science Park, Fruebjergvej 3
DK-2100 Copenhagen Ø, Denmark
Phone: +45 3917 8335
Mobile: +45 228 226 11
[EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Pierre

Hi Andi,

On 2/4/07, Andi Gutmans <[EMAIL PROTECTED]> wrote:

Hi,

I thought I may have brought this up a long time ago but couldn't find anything 
in the archives.
For a long time already I've been thinking about possibly adding a new syntax 
for array(...) which would be shorter. I'd suggest
[...]. While I am usually not in favor of having more than one way to do 
things, I think it'd look much more elegant especially (but
not only) for nested arrays.

So what I'm thinking of is:
array(1, 2, 3) == [1, 2, 3]
array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]

$arr = [1, 2, 3]
vs.
$arr = array(1, 2, 3)

Well enough examples given :)
I think it's not worth doing unless there's overwhelming support as it's not 
desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue but I'd have 
to dive a bit deeper.


I like this syntax, it is clear and easy to write. All other languages
use this syntax already (using either {} or [] but same principle) and
it can be done while keeping the classic array() definition. No need
to mention the numerous requests to add it to php.

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread phpxcache

I think it's not worth doing unless there's overwhelming support as it's not 
desperately needed. But I'd be interested to hear
people's thoughts. It seems implementation shouldn't be an issue but I'd have 
to dive a bit deeper.

it sure acceptable for php users and will never be a conflict to "php way"
php is mean to be used for web pages in the first place, most ppl who
works on web pages have to know what javascript is, so there isn't any
difficulty for ppl to get used to either read or code []
btw, "ppl use json in instead of xml" may (or may not) be a good
example to this topic

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Syntactic improvement to array

2007-02-04 Thread Marcus Boerger
Hello Andi,

  it is a bit harder to read and not the php way imo.

best regards
marcus

Sunday, February 4, 2007, 8:25:22 AM, you wrote:

> Hi,

> I thought I may have brought this up a long time ago but couldn't find 
> anything in the archives.
> For a long time already I've been thinking about possibly adding a new
> syntax for array(...) which would be shorter. I'd suggest
> [...]. While I am usually not in favor of having more than one way to do
> things, I think it'd look much more elegant especially (but
> not only) for nested arrays.

> So what I'm thinking of is:
> array(1, 2, 3) == [1, 2, 3]
> array(1, 2, array("foo", "bar")) == [1, 2, ["foo", "bar"]]
> array("key" => 1, "key2" => 2) == ["key" => 1, "key2" => 2]

> $arr = [1, 2, 3]
> vs.
> $arr = array(1, 2, 3)

> Well enough examples given :)
> I think it's not worth doing unless there's overwhelming support as it's
> not desperately needed. But I'd be interested to hear
> people's thoughts. It seems implementation shouldn't be an issue but I'd have 
> to dive a bit deeper.

> Andi




Best regards,
 Marcus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php