Contra ... Not searchable through search engines That's a ridiculous argument.
(The "true" causes the value to be returned rather than printed, obviously.)
51–60 of 89 posts
Contra ... Not searchable through search engines That's a ridiculous argument.
(The "true" causes the value to be returned rather than printed, obviously.)
Earlier quoted context omitted.
I don't think that a concise method of working with arrays should be thought of as syntactic sugar, not if you mean it in a pejorative way. I found array_map, array_filter, array_key_exists, array_this, array_that painful to write, but never felt that I was gaining any sort of readability for it.
No I meant "syntactic sugar" in a good way, i didnt realise it was a pejorative. I mean it as per the definition on wikipedia: Syntactic sugar is a computer science term that refers to syntax within a programming language that is designed to make things easier to read or to express, while alternative ways of expressing them exist.
Concentrations of people who dislike all syntax sugar can be found in the Forth community and concatenative languages in general, Lisp, and to a lesser extent, in the Haskell community. People who think syntax sugar is the answer to everything can be found in the Perl 5 community, and Perl 6 is arguably syntax sugar spun into cotton candy, hardened, and used to build a glorious gossamer castle in the sky, which they are currently working on landing. I have taken this metaphor too far.
Earlier quoted context omitted.
I catch myself feeling that way, too, but it is uncharitable and inaccurate. They do work a lot of work on developing the language. The issue is that sometimes their idea of what is should be differs from the idea that most people have.
I don't think it's possible to be too uncharitable about the developers of PHP. Courtesy demands that we give them the benefit of the doubt; but by this stage there is very little doubt left, so very little benefit as well.
that decision, though, is unfortunate IMHO. esp seeing that the userland votes are overwhelmingly pro while the devs are con.
Earlier quoted context omitted.
I catch myself feeling that way, too, but it is uncharitable and inaccurate. They do work a lot of work on developing the language. The issue is that sometimes their idea of what is should be differs from the idea that most people have.
I don't think it's possible to be too uncharitable about the developers of PHP. Courtesy demands that we give them the benefit of the doubt; but by this stage there is very little doubt left, so very little benefit as well.
The statement that "It's like they don't even _want_ to fix the language" is inaccurate. It does not relate to the state of things in the real world.
Accusing the developers of some warped intent to keep it in a broken state is an understandable expression of frustration, but it does nothing to advance our discussion and contributes to a misunderstanding of the situation.
Earlier quoted context omitted.
Sure but this seems better: $foo = [ 'bar': TRUE, 'baz': 'socks' ]
It's kind of JSON-wish, so this would make more sense: $bar = [1, 2, 3]; $foo = { 'bar': TRUE, 'baz': 'socks' };
array(1, 'bar' => TRUE, 3, 'baz' => 'socks');
But I do like this syntax idea.Earlier quoted context omitted.
Sure but this seems better: $foo = [ 'bar': TRUE, 'baz': 'socks' ]
It's kind of JSON-wish, so this would make more sense: $bar = [1, 2, 3]; $foo = { 'bar': TRUE, 'baz': 'socks' };
I'm of the opinion you should be writing your PHP in a readable fashion similar to this: $foo = array( 'bar' => TRUE, 'baz' => 'socks' ) (pretend you also have proper tabs as well)
foo = [
'first',
'second',
'third',
]
or foo = [ 'first'
, 'second'
, 'third'
]
The difference between those two examples and yours being that when you want to add a new entry, you only have to edit the line of the entry, rather than having to edit the line before the entry (to put in the comma) as well as the line that you care about. Just an idle question, really.EDIT: pull unnecessary commentary
Earlier quoted context omitted.
Sure but this seems better: $foo = [ 'bar': TRUE, 'baz': 'socks' ]
It's kind of JSON-wish, so this would make more sense: $bar = [1, 2, 3]; $foo = { 'bar': TRUE, 'baz': 'socks' };
$foo = { bar: TRUE, baz: 'socks' };
where keys are unquoted. The less typing the better.
Why does the same criteria not apply to short array syntax? If you don't want to use it, don't use it, but hundreds of thousands of other people likely do want it.
FWIW, I first remember hearing about this in 2003/2004, and at that time I was against it for most of the same reasons I've read in opposition to adding it. Working outside of PHP for some time, I've come to realize the shortsightedness I labored under, and would fully love to have this.
I'm not 100% sure the votes on that page are from May 2011 - it's hard to tell for sure.
I'm of the opinion you should be writing your PHP in a readable fashion similar to this: $foo = array( 'bar' => TRUE, 'baz' => 'socks' ) (pretend you also have proper tabs as well)
It's been a long time since I did any PHP, but are trailing commas illegal? Normally, it seems like languages follow one of these two patterns, depending on whether their syntax allows extraneous commas or not: foo = [ 'first', 'second', 'third', ] or foo = [ 'first' , 'second' , 'third' ] The difference between those two examples and yours being that when you want to add a new entry, you only have to edit the line o…
$a = array(1,2,3,); works just fine.