Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37973 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95434 invoked from network); 28 May 2008 17:26:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 May 2008 17:26:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=jani.taskinen@sci.fi; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jani.taskinen@sci.fi; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sci.fi from 63.208.196.178 cause and error) X-PHP-List-Original-Sender: jani.taskinen@sci.fi X-Host-Fingerprint: 63.208.196.178 mho-01-bos.mailhop.org Received: from [63.208.196.178] ([63.208.196.178:63538] helo=mho-01-bos.mailhop.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/33-10063-9A59D384 for ; Wed, 28 May 2008 13:26:02 -0400 Received: from [81.22.163.71] (helo=localhost.localdomain) by mho-01-bos.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1K1PPS-000HIG-Py; Wed, 28 May 2008 17:25:59 +0000 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 81.22.163.71 X-Report-Abuse-To: abuse@dyndns.com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+UtKzUIHT5xLA0jgloBpp3vNSYh91nvNE= Message-ID: <483D95A5.1040206@sci.fi> Date: Wed, 28 May 2008 20:25:57 +0300 Reply-To: jani.taskinen@iki.fi User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: Mike CC: Mailing List References: <0412F6FE505049F7901EAB8C61774839@pc> <87.77.15519.9E47C384@pb1.pair.com> <97.F8.15519.1229C384@pb1.pair.com> <483C94EA.90507@zend.com> <483C95DD.6000006@sci.fi> <698DE66518E7CA45812BD18E807866CE01A53A06@us-ex1.zend.net> <1211994665.7621.39.camel@ipso.snappymail.ca> In-Reply-To: <1211994665.7621.39.camel@ipso.snappymail.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Short syntax for array literals [...] From: jani.taskinen@sci.fi (Jani Taskinen) Exactly. Open this can of worms and soon PHP is something else than easy to learn.. someone already mentioned that {} thing for objects.. :) Sidenote: There are more important things to solve in PHP 5.3 (and especially HEAD) than adding this little syntax sugar.. --Jani Mike wrote: > In my opinion I don't think PHP would be where it is today if it wasn't > for being so easy to learn and use. > > I attribute this directly to the fact that it didn't use a lot of > "syntax sugar" that is unreadable and can't be "Googled" for. You can't > Google "[]", and my guess is searching PHP.net for "[]" won't return > anything useful either. > > Using Array() is SELF EXPLANATORY! Anyone can see that, search Google > for "Array" and learn something about it. > > How many man hours are going to be wasted: > 1. Searching for what the heck [] actually is. > 2. Explaining to people that [] is the same as Array. > 3. Changing coding standards for projects to prevent [] from being > used. > 4. Enforcing coding standards for projects to prevent [] from being > used. > 5. Trying to change [] back to Array in hopes of getting code to work on > older versions of PHP. > 6. All the man hours wasted on it ALREADY that I'm sure could be much > better spent getting PHP 5.3/6.0 out. > > There are enough roadblocks and other things to worry about already, why > would we want to add MORE? Especially for something with so little to > gain (if anything at all). > > This isn't about "well if you don't like it, don't use it" either, > because no matter what it will be forced on people who don't like it > eventually. People who like it will be constantly changing Array() -> [] > and people who hate it will be constantly changing [] -> Array(). More > wasted time. > > Just my two cents. > > On Wed, 2008-05-28 at 08:56 -0700, Chris Stockton wrote: >> +1 for: ['foo' => 'bar'], Not sure if it was decided but -1 for ['foo': >> 'bar'] >> >> Here is why, >> >> Array(), is much more confusing to someone coming with no experience in php >> then []. Array() in most languages looks like a function call. So >> Array('foo' => 'bar'), verse ['foo' => 'bar'], most people will more easily >> understand the latter when entering into the language fresh. >> >> I.E.: >> $f = Array('foo' => 'bar'); >> $f('foo'); // comes to mind first right, might not for a php developer but >> for a new comer maybe? >> >> $f = ['foo' => 'bar']; >> $f['foo']; // great >> >> Gives our users options, and does not break any existing code or enforce new >> programming paradigm. The change is minor and no real cost in performance. >> >> As for existing users, I find the completely negative comments a real >> hindrance on the evolution of php as a language. If something does not >> damage the language but will offer benefits for a broad user base, as well >> as existing code, then let it be. I for one will change every line of code I >> have that uses the Array() syntax for the shorter, more WIDELY readable [] >> syntax. >> >> My only curiosity is if this will turn into a ecmascript morphism and we >> wind up with a new object proposal instead of stdclass, like >> >> $oStd = {'foo' => 'bar'}; >> echo $oStd->foo; >> >> ... doesn't even look all that bad but feels wrong and dirty, I think I >> would rather (object) ['foo' => 'bar']; :p >> >> -Chris