On 1/29/06, James Crane <[EMAIL PROTECTED]> wrote:
>
> No, it's definitely not that hard to write, but I have seeing
> 'array()' everywhere when I know damn well that it's an array.
>
> Concerning the 'pass by reference' problems, I'm going to assume that
> that's happening when you're working with some of the functions
> already in PHP or someone else's code, when you don't exactly know (or
> remember) that a function does something particular to the parameters.
> I know how I design my functions and I've never had any problems with
> passing in array literals. I do it all the time and the only problem I
> have is having to write in this function-like syntax for an array
> literal.
>
> > Now PHP is how people make their living.  People rely on it.  It can not
> > change on a whim because someone wants to save 5 key strokes when they
> > are creating an array.  Use a decent editor and write a macro.
>
> See, the thing about having them both work is that none of the
> previous code would be affected. It would allow ability to use it for
> those who want to, and to use the older syntax for those who don't.
> And simply writing a macro with a decent text editor isn't solving my
> issue with 'array()' everywhere – my issue is that this is everywhere
> instead of something shorter like [...].
>
> I see it as expanding the functionality of the brackets from just
> being used for retreiving and setting array properties, but creating
> them as well. As in:
>
> $created_array = ['key1'=>'value', 'key2'=>'value'];
> $created_array['key3'] = "value";
> $key2 = $created_array['key2'];
>
> Etc. You see, it's just evolution for the brackets, expanding to fill
> the rest of its role.
>
> I don't see PHP as necessarily crippled, you're right, but I do see it
> as something that does not make sense. Creating an array shouldn't
> require what looks like a function, whereas I can understand
> 'include()', 'echo()', et al would take that form because they do
> behave and respond like functions.
>
> For me, I see the whole block of code as the array, not just what goes
> inside the ()s. It doesn't make sense to have something that looks
> like a function as part of the actual data.


Why not?  As long as it returns a value on evaluation...
$myArray = array( 3, computeValue(6), "cat", array("blue", "green") ).

Seems OK to me.


M.T.
>

Reply via email to