Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.
Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.
There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');
These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus
--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/
Hello Ryusuke,
I like b) !
marcus
Thursday, January 10, 2008, 11:07:36 AM, you wrote:
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.
Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.
There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');
These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus
--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/
Best regards,
Marcus
If we are going to implement this, I think we should use the (b) syntax
since its how you define array elements today
Hello Ryusuke,
I like b) !
marcus
Thursday, January 10, 2008, 11:07:36 AM, you wrote:
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut'
thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe
you
want to start a second '[RFC] Anonymous functions' thread with that
patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/Best regards,
Marcus--
--
Saulo Vallory
descolando! - www.descolando.com.br
LegoCode - www.legocode.com.br
Neoconn Networks - www.neoconn.com
+55 21 8182-0308
So you reject scalar type hinting because it isn't type casting and
can therefor confuses newbies - but scattering seemingly random
brackets around your code (to safe 5 key strokes) is obvious to users?
Noone would confuse this with named arguments?
Why can't I do function foo([] $array) {} ?
foo([]);
$var = [];
Is this really readable?
Are you really serious about this?
-Hannes
Hello Ryusuke,
I like b) !
marcus
Thursday, January 10, 2008, 11:07:36 AM, you wrote:
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/Best regards,
Marcus
Well if confusing is the goal, then yes, since this is classic Perl.
I started using PHP, instead of Perl, just so that I would not need play
around with confusing syntax.
Tomi Kaistila
PHP Developer
On Thursday 10 January 2008 15:56:54 Hannes Magnusson wrote:
So you reject scalar type hinting because it isn't type casting and
can therefor confuses newbies - but scattering seemingly random
brackets around your code (to safe 5 key strokes) is obvious to users?Noone would confuse this with named arguments?
Why can't I do function foo([] $array) {} ?foo([]);
$var = [];
Is this really readable?Are you really serious about this?
-Hannes
Hello Ryusuke,
I like b) !
marcus
Thursday, January 10, 2008, 11:07:36 AM, you wrote:
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut'
thread to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe
you want to start a second '[RFC] Anonymous functions' thread with
that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/Best regards,
Marcus
Well if confusing is the goal, then yes, since this is classic Perl.
I started using PHP, instead of Perl, just so that I would not need
play
around with confusing syntax.
Right, PHP was always about making it easy to see whats going on and
more importantly to at least be able to quickly look something up in
the manual. Maybe the better approach would be to hide "array" inside
the browser and magically add it if its "missing".
regards,
Lukas
Well if confusing is the goal, then yes, since this is classic Perl.
I started using PHP, instead of Perl, just so that I would not need play
around with confusing syntax.Tomi Kaistila
PHP Developer
The [] array literal syntax is also used by Javascript, and there's even an
object literal syntax, {}, which is quite nice. Does that mean "Javascript
is classic Perl"?
The [a:b, c:d] syntax would be more JSON-esque, while [a => b] syntax would be
more consistent with existing PHP. The latter, I think, would get better
traction with existing developers and be easier to understand (since it uses
the same separator character).
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
The [] array literal syntax is also used by Javascript, and there's even an
object literal syntax, {}, which is quite nice. Does that mean "Javascript
is classic Perl"?
Yes, the first thing that comes to mind from this syntax is Perl.
(1, 2, 3, 4, 5)
("dharma", "wilma", "greg", "mina")
qw{ wilhelm yaztsee ben madonna }
qw! wilhelm yaztsee ben madonna !
qw[ wilhelm yaztsee ben madonna ]
Does this look familiar? Javascript is not classic Perl but the proposed way
of assign array values is.
The [a:b, c:d] syntax would be more JSON-esque, while [a => b] syntax would
be more consistent with existing PHP. The latter, I think, would get
better traction with existing developers and be easier to understand (since
it uses the same separator character).
If this is implemented, I would agree that sticking as close to the old syntax
as possible is the best approach.
I would go with the choice B except instead of square brackets use round
brackets.
$a = (1, 2, 3, 4, 5);
$a = (1 => 'dharma', 2 => 'wilma');
This would be consistent with the old way of assigning array values and will
probably least confuse both new and old developers.
Tomi Kaistila
PHP Developer
Hi,
So you reject scalar type hinting because it isn't type casting and
can therefor confuses newbies - but scattering seemingly random
brackets around your code (to safe 5 key strokes) is obvious to users?Noone would confuse this with named arguments?
Why can't I do function foo([] $array) {} ?
Can you do function foo(array() $array) {} ?
foo([]);
$var = [];
Is this really readable?
Looks readable to me ;-)
FWIW if it's going to be implemented I think (b) should be the choice
as it is more consistent with current syntax even though I like (a)
more.
Are you really serious about this?
-Hannes
Hello Ryusuke,
I like b) !
marcus
Thursday, January 10, 2008, 11:07:36 AM, you wrote:
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/Best regards,
Marcus--
--
Regards,
Giedrius
Hi,
So you reject scalar type hinting because it isn't type casting and
can therefor confuses newbies - but scattering seemingly random
brackets around your code (to safe 5 key strokes) is obvious to users?Noone would confuse this with named arguments?
Why can't I do function foo([] $array) {} ?
Can you do function foo(array() $array) {} ?foo([]);
$var = [];
Is this really readable?
Looks readable to me ;-)
I really like $var = []; but I don't like foo([]) at all.
FWIW if it's going to be implemented I think (b) should be the choice
as it is more consistent with current syntax even though I like (a)
more.Are you really serious about this?
-Hannes
Hello Ryusuke,
I like b) !
marcus
Thursday, January 10, 2008, 11:07:36 AM, you wrote:
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/Best regards,
Marcus--
--
Regards,
Giedrius
So you reject scalar type hinting because it isn't type casting and
can therefor confuses newbies - but scattering seemingly random
brackets around your code (to safe 5 key strokes) is obvious to users?Noone would confuse this with named arguments?
Why can't I do function foo([] $array) {} ?foo([]);
$var = [];
Is this really readable?Are you really serious about this?
I don't think the only benefit in this would be to save keystrokes. I
think it looks better, and makes code more readable, whereas the current
way just looks like a function call.
-Hannes
Hello Ryusuke,
I like b) !
marcus
Thursday, January 10, 2008, 11:07:36 AM, you wrote:
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/Best regards,
Marcus
So you reject scalar type hinting because it isn't type casting and
can therefor confuses newbies - but scattering seemingly random
brackets around your code (to safe 5 key strokes) is obvious to users?Noone would confuse this with named arguments?
Why can't I do function foo([] $array) {} ?foo([]);
$var = [];
Is this really readable?Are you really serious about this?
I don't think the only benefit in this would be to save keystrokes. I
think it looks better, and makes code more readable, whereas the current
way just looks like a function call.
Not only do I agree, but I'll also refer anyone wondering how well
it would really be adopted due to the initial difficulty in
recognizing the structure to the ternary operator. Unless it's an
obvious condition and result, ternary operation itself is equally - if
not more - trivial to initially figure out than $a = [1,2,3];.
--
</Dan>
Daniel P. Brown
Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since 1979.
So you reject scalar type hinting because it isn't type casting and
can therefor confuses newbies - but scattering seemingly random
brackets around your code (to safe 5 key strokes) is obvious to users?Noone would confuse this with named arguments?
Why can't I do function foo([] $array) {} ?foo([]);
$var = [];
Is this really readable?Are you really serious about this?
I have to agree with this. It looks all cool and nice and stolen from
another language. But in the long end, all this does is saving you 5
chars to type, and lose a hell of a lot readability in the meanwhile.
(In case it's not obvious: -1)
regards,
Derick
I like b.
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/
I just tried this out using option b, and I really like it.
$var = [1, 6, 434] ;
I think it looks good and helps code readability alot.
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/
Did you know that you don't have to reply multiple times to the same post?
And even though Stas replies to every single post, you don't have to do it too.
Please read Andis "checklist" again;
http://news.php.net/php.internals/34494 - same "rules" apply to all
threads.
-Hannes
I just tried this out using option b, and I really like it.
$var = [1, 6, 434] ;
I think it looks good and helps code readability alot.
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple. Maybe you
want to start a second '[RFC] Anonymous functions' thread with that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/
I think next time Sam has three consecutive responses to the same thread
then he loses access to the list for a week :) (same rule for anyone
else). Tweaking the 'Subject' won't count as a different thread :)
Andi
-----Original Message-----
From: Hannes Magnusson [mailto:hannes.magnusson@gmail.com]
Sent: Thursday, January 10, 2008 6:49 AM
To: Sam Barrow
Cc: PHP Development
Subject: Re: [PHP-DEV] [RFC] Square brackets shortcutDid you know that you don't have to reply multiple times to the same
post?
And even though Stas replies to every single post, you don't have to
do
it too.Please read Andis "checklist" again;
http://news.php.net/php.internals/34494 - same "rules" apply to all
threads.-Hannes
I just tried this out using option b, and I really like it.
$var = [1, 6, 434] ;
I think it looks good and helps code readability alot.
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' =>
'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets
shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple.
Maybe you
want to start a second '[RFC] Anonymous functions' thread with
that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then
(even
though myself and Andi liked it) - did the people that
objected
then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/
I think next time Sam has three consecutive responses to the same thread
then he loses access to the list for a week :) (same rule for anyone
else). Tweaking the 'Subject' won't count as a different thread :)Andi
-----Original Message-----
From: Hannes Magnusson [mailto:hannes.magnusson@gmail.com]
Sent: Thursday, January 10, 2008 6:49 AM
To: Sam Barrow
Cc: PHP Development
Subject: Re: [PHP-DEV] [RFC] Square brackets shortcutDid you know that you don't have to reply multiple times to the same
post?
And even though Stas replies to every single post, you don't have to
do
it too.Please read Andis "checklist" again;
http://news.php.net/php.internals/34494 - same "rules" apply to all
threads.-Hannes
I just tried this out using option b, and I really like it.
$var = [1, 6, 434] ;
I think it looks good and helps code readability alot.
Hello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' =>
'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets
shortcut' thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple.
Maybe you
want to start a second '[RFC] Anonymous functions' thread with
that patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then
(even
though myself and Andi liked it) - did the people that
objected
then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/--
--
--
If you want reasons just ask me privately, as Pierre said, no need to argue :)
-1
D
I recommended (b) a few months back and got shot down :)
I still like it :)
Andi
-----Original Message-----
From: Ryusuke SEKIYAMA [mailto:rsky0711@gmail.com]
Sent: Thursday, January 10, 2008 2:08 AM
To: internals@lists.php.net
Cc: Marcus Boerger; Stas Malyshev
Subject: [PHP-DEV] [RFC] Square brackets shortcutHello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut'
thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple.
Maybe you
want to start a second '[RFC] Anonymous functions' thread with that
patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected
then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/
I don't remember ever seeing this before, but I'm still very strongly
against this kind of useless syntax sugar..
--Jani
I recommended (b) a few months back and got shot down :)
I still like it :)Andi
-----Original Message-----
From: Ryusuke SEKIYAMA [mailto:rsky0711@gmail.com]
Sent: Thursday, January 10, 2008 2:08 AM
To: internals@lists.php.net
Cc: Marcus Boerger; Stas Malyshev
Subject: [PHP-DEV] [RFC] Square brackets shortcutHello, lists,
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.Stanislav,
Sorry, I'm new in this list and I didn't know about past
discussion. As Marcus says, I'd like to ask around again.There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');These patches include the tests.
Which do you like? I like (a) the best.
Regards,
2008/1/6, Marcus Boerger helly@php.net:
Hello Stanislav,
tha makesw three then already, how about we ask around again?
Ryusuke, can you please start a new '[RFC] Square brackets shortcut'
thread
to collect opinions and pass along the patch for that?I like the anonymous function patch too. It is clean and simple.
Maybe you
want to start a second '[RFC] Anonymous functions' thread with that
patch.Can you also please add tests for both?
marcus
Wednesday, January 2, 2008, 7:51:06 PM, you wrote:
the square bracket array syntax patch for PHP 5.3,
http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patchI remember we discussed that already and it was rejected then (even
though myself and Andi liked it) - did the people that objected
then
change their minds?Best regards,
Marcus--
/**
- Ryusuke SEKIYAMA
- rsky0711@gmail.com
*/--
--
Patches/Donations: http://pecl.php.net/~jani/
Hi,
b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
I like this one, +1
ps: no need to argue why you don't like, it would be nice to simply
say +1/-1, trolls quota is already full for this year :)
--
Pierre
http://blog.thepimp.net | http://www.libgd.org
Hello, lists,
I'm tired to type "array()" many times.
-1
The parser in my head is unable to parse this:
<?php
$var=["str"];
$var["str"]=1;
?>
--
Wbr,
Antony Dovgal
Antony Dovgal wrote:
Hello, lists,
I'm tired to type "array()" many times.
-1
The parser in my head is unable to parse this:
<?php
$var=["str"];
$var["str"]=1;
?>
Eh, that would just come out as
[ 0 => "str",
"str" => 1 ]
Not too problematic in my mind.
+1 for square brackets.
+1
firstly, square brackets are natural short cut to array(...) that you can
find in many many language, one may argue this is merely a minor addition.
however, PHP is already a very verbose compare to other language, syntactic
improvements adds up it allows us to create much more readable code.
someone raise up the readability issue of nested array, this is not a
language issue, but rather programming style issue. its up to you to make it
clean or verbose as you want it to be. yes, associative array may can look
awkward. [] is just a short cut, there is nothing stopping you mix and
match.
$lists = array(
'first' => [ 1, 2 ,3, 4 ] ,
'second' => [ 45, 33, 19 ]
);
Lastly, one may again argue this will introduce extra workload for tester,
commiter, patchers. This is a new addition to the language, there is no
Backward compatibility issue. This isn't a technical issue, but rather
management issue.
PHP On the language design level hasn't been making much progress, PHP needs
to move forward. proper closure, GC, and this.
Antony Dovgal wrote:
Hello, lists,
I'm tired to type "array()" many times.
-1
The parser in my head is unable to parse this:
<?php
$var=["str"];
$var["str"]=1;
?>Eh, that would just come out as
[ 0 => "str",
"str" => 1 ]Not too problematic in my mind.
+1 for square brackets.--
--
Best Regards,
Taylor luk
+1
I hope this didn't die; As a developer, I really like to use this
syntax, and find it preferably from working with javascript, ruby,
python, etc.
Regards,
Eric
+1
firstly, square brackets are natural short cut to array(...) that
you can
find in many many language, one may argue this is merely a minor
addition.
however, PHP is already a very verbose compare to other language,
syntactic
improvements adds up it allows us to create much more readable code.someone raise up the readability issue of nested array, this is not a
language issue, but rather programming style issue. its up to you to
make it
clean or verbose as you want it to be. yes, associative array may
can look
awkward. [] is just a short cut, there is nothing stopping you mix and
match.$lists = array(
'first' => [ 1, 2 ,3, 4 ] ,
'second' => [ 45, 33, 19 ]
);Lastly, one may again argue this will introduce extra workload for
tester,
commiter, patchers. This is a new addition to the language, there is
no
Backward compatibility issue. This isn't a technical issue, but rather
management issue.PHP On the language design level hasn't been making much progress,
PHP needs
to move forward. proper closure, GC, and this.On Jan 20, 2008 2:26 PM, Darius Jahandarie djahandarie@gmail.com
wrote:Antony Dovgal wrote:
Hello, lists,
I'm tired to type "array()" many times.
-1
The parser in my head is unable to parse this:
<?php
$var=["str"];
$var["str"]=1;
?>Eh, that would just come out as
[ 0 => "str",
"str" => 1 ]Not too problematic in my mind.
+1 for square brackets.--
--
Best Regards,Taylor luk
I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.
I don't think tiredness to type an extra five characters should be an
excuse to change the syntax. There are language specifically designed
to require the minimum number of characters to be typed — if this is a
real concern, you'd be better off using one of them and not PHP.
There are three options:
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
Breaks from PHP's => for no apparent reason (one character too many
character this time?), which is just confusing (that's an implicit -1).
b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
Breaks backwards compatibility to save typing five characters. See
above. -1.
c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');
For all the above reasons, +1.
--
Geoffrey Sneddon
<http://gsnedders.com/
I don't think tiredness to type an extra five characters should be an
excuse to change the syntax.
No, but clarity of expression is a valid reason to do so.
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
Breaks from PHP's => for no apparent reason (one character too many
character this time?), which is just confusing (that's an implicit -1).
Agreed;
b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
Breaks backwards compatibility to save typing five characters. See
above. -1.
It doesn't break backwards compatibility; the new syntax is an alias, not a
replacement. The older array() syntax will still be in place, if I've
understood the earlier posts correctly.
--
Mark Dennehy
b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
Breaks backwards compatibility to save typing five characters. See
above. -1.It doesn't break backwards compatibility; the new syntax is an
alias, not a
replacement. The older array() syntax will still be in place, if I've
understood the earlier posts correctly.
Maybe I did not express myself well enough: this introduces a new
syntax for something that isn't broken that doesn't work on existing
PHP versions.
--
Geoffrey Sneddon
<http://gsnedders.com/
a) Commit square bracket array shortcut patch
keys and values are separated by colons.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];Breaks from PHP's => for no apparent reason (one character too many
character this time?), which is just confusing (that's an implicit -1).b) Commit square bracket array shortcut patch
keys and values are separated by double arrows.
( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch )
e.g.
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];Breaks backwards compatibility to save typing five characters. See
above. -1.c) Reject and keep using `array()'.
e.g.
$a = array(1, 2, 3);
$b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');For all the above reasons, +1.
In my post i not write about variant "a)"
+1 too.