On 2009-10-10 12:12:27 -0400, "Lars T. Kyllingstad" <pub...@kyllingen.nospamnet> said:

Christopher Wright wrote:
Don wrote:
At worst, it would be something like:

exec("description", createArray(procName, arg1, arg2) ~ generatedArgs ~ createArray(arg3, arg4) ~ moreGeneratedArgs);

PHP does this. I haven't used PHP enough to hate it.


I've used PHP a fair bit, and I don't hate its array syntax at all. (There are plenty of other things in PHP to hate, though.) It's easily readable, and not much of a hassle to write. But array() in PHP isn't a function, it's a language construct with special syntax. To create an AA, for instance, you'd write

   $colours = array("apple" => "red", "pear" => "green");

I'm not sure what the D equivalent of that one should be.

Associative array literals:

        string[string] s = ["hello": "world", "foo": "bar"];

Note that an "array" in PHP is always a double-linked list indexed by a hash-table. Writing `array(1, 2, 3)` is the same as writing `array(0 => 1, 1 => 2, 2 => 3)`: what gets constructed is identical. That's quite nice as a generic container.



--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to