Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37831 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48978 invoked from network); 23 May 2008 15:18:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2008 15:18:15 -0000 Authentication-Results: pb1.pair.com header.from=wangyi6854@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=wangyi6854@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.142.184 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: wangyi6854@gmail.com X-Host-Fingerprint: 209.85.142.184 ti-out-0910.google.com Received: from [209.85.142.184] ([209.85.142.184:33045] helo=ti-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/21-35754-730E6384 for ; Fri, 23 May 2008 11:18:15 -0400 Received: by ti-out-0910.google.com with SMTP id u3so586489tia.17 for ; Fri, 23 May 2008 08:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=jQfvYEBh9rtmggS3G2Otv3fxh1D/W4EaOciZUBZthsk=; b=Cas8Xl5bNl0mk7nwvfutcu8tPwlaZo/2R//7ACvl8U437HK0HWhHdnNK1CWbb/0mEsVKAFhsmlfDXo7OUs0Tsv2E/eII0CPR0H0hu8gKT/o4Aberk5Xu/ePa9k6wteXNdMX3k+ijz2GlIA2ZUuAEgQGvlMplCJKHyowwWaB8MRg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=FrMVQpvMXVVpDRsmKhf3Khb+h/S3LVhyD1pgyAhIZmhKNKZzY11VAf9zBMqwVUyM6XIocfa+uIxMt6vxUs80mZ98kGYbi1PhuVcqGEGIjwRHp27AhuQqfIsHxgC0gjdfvbhF4+unY5IkBhM8hQ9pYaQ2W0VpFq7Jw5AXIhydiIs= Received: by 10.110.26.20 with SMTP id 20mr194605tiz.23.1211555890691; Fri, 23 May 2008 08:18:10 -0700 (PDT) Received: by 10.110.8.4 with HTTP; Fri, 23 May 2008 08:18:10 -0700 (PDT) Message-ID: <5ea5cca50805230818h4120cdcax839e6cb25de81960@mail.gmail.com> Date: Fri, 23 May 2008 23:18:10 +0800 To: "Stan Vassilev | FM" Cc: "PHP Developers Mailing List" In-Reply-To: <0412F6FE505049F7901EAB8C61774839@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <0412F6FE505049F7901EAB8C61774839@pc> Subject: Re: [PHP-DEV] Short syntax for array literals [...] From: wangyi6854@gmail.com ("Yi Wang") I'm not using this syntax. But I don't oppose it. On 5/22/08, Stan Vassilev | FM wrote: > > Hi, > > I hear this often by other developers and I tend to agree with them, that arrays are used often, and often nested, so that having a long syntax for array literals tend to produce less legible code than in other scriping languages. > > $a = array(array(1,2), array(3,4), 5, 6); > > $b = array('a' => 1, 'b' =>2); > > We use arrays in our configurations, in passing complex parameters to functions, fetching information from databases, basically everything. So it adds up. > > Some frameworks have somewhat funny attempts to remedy this by introducing "shortcuts" like this: function a() { return func_get-args(); }. Of course this doesn't work when you need to specify the key name, and the overhead isn't worth it. > > It looks as there may not be a specific reason not to allow the JS syntax as an alternative syntax (while keeping the current one in parallel): > > $a = [[1, 2], [3, 4], 5, 6]; > > $b = ['a' => 1, 'b' =>2]; > > There shouldn't be confusion to the parser as the brackets aren't preceded by an identifier. > > Was this discussed before on the list? > > Regards, > > Stan Vassilev -- Regards, Wang Yi