News for hackers. Stuff that matters.
Re:PHP 5.5.0 Alpha 6 - Released by Mahn on Friday March 08, 2013 @06:19PM (#5346414)
Frankly, it would be infinitely better to be able to write:

    $data = {
        firstName: "John",
        lastName: "Smith",
        age: 25,
        address: {
            streetAddress: "21 2nd Street",
            city: "New York",
            state: "NY",
            postalCode: 10021
        },
        phoneNumber: {
            home: {
                number: "212 555-1234"
            },
            fax: {
                number: "646 555-4567"
            }
        }
    };
Rather than the awkward and verbose:

    $data = (object) [
        "firstName" => "John",
        "lastName" => "Smith",
        "age" => 25,
        "address" => (object) [
            "streetAddress" => "21 2nd Street",
            "city" => "New York",
            "state" => "NY",
            "postalCode" => 10021
        ],
        "phoneNumber": (object) [
            "home" => (object) [
                "number" => "212 555-1234"
            ],
            "fax" => (object) [
                "number" => "646 555-4567"
            ]
        ]
    ];
JSON is everywhere these days, supporting object literals is a very, very big deal; I understand which features to implement are handpicked very carefully so as not to clutter more the core, but we are talking about making the life of devs who use and write JSON more difficult, and that happens to be lots of folks.

Telling people to use arrays and be done with it is the equivalent of implement a strpos function that may only accept a string that's 5 characters long — yes, theoretically you can work with that splitting your strings, but that's time consuming and a inconsistent behaviour (why would 10 character long strings be less of a citizen than 5 char long ones?)

Re:PHP 5.5.0 Alpha 6 - Released by Jeremy1026 on Friday March 08, 2013 @06:35PM (#5346485)
JSON, JavaScript Object Notation. How does it make sense to write PHP in Javascript syntax, when PHP has its own defined syntax?
Re:PHP 5.5.0 Alpha 6 - Released by Mahn on Friday March 08, 2013 @06:41PM (#5346507)
Because 1) PHP syntax for object literals is non-existent 2) JSON is used in many more places than just Javascript and 3) the syntax of JSON makes sense; it's compact, human readable and easy to write. I'm not suggesting copying it 1:1 verbatim, but something close to JSON would definitely be an improvement. See for example how MongoDB uses a JSON-like syntax to great effect.
Re:PHP 5.5.0 Alpha 6 - Released by krapp on Friday March 08, 2013 @06:59PM (#5346577)
If for no other reason than ':' is easier to type than '=>'?
Re:PHP 5.5.0 Alpha 6 - Released by BystanderX on Friday March 08, 2013 @07:29PM (#5346694)
Hell will surely descend upon me, but I'd vote for having it be syntactic sugar for => in general.
Re:PHP 5.5.0 Alpha 6 - Released by krapp on Friday March 08, 2013 @08:53PM (#5346921)
You can already use the js-style shorthand inside of Twig templates, and I've been caught absentmindedly forgetting to switch to the 'proper' way for raw php now and then. And I would like to never need to even touch the shift key when having to write out an array or an object but even JSON won't let you do that. It's a step in the right direction, though.