Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23774 invoked by uid 1010); 11 Jan 2008 14:18:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 23758 invoked from network); 11 Jan 2008 14:18:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2008 14:18:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=foolistbar@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=foolistbar@googlemail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 66.249.92.172 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: foolistbar@googlemail.com X-Host-Fingerprint: 66.249.92.172 ug-out-1314.google.com Received: from [66.249.92.172] ([66.249.92.172:11555] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/D7-09267-89A77874 for ; Fri, 11 Jan 2008 09:18:03 -0500 Received: by ug-out-1314.google.com with SMTP id u40so460912ugc.29 for ; Fri, 11 Jan 2008 06:17:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; bh=N8z22z75y+wjw8cdjLl0GBWkzexYMyg0jWSitDwjKmQ=; b=rw3xbiUy2ghgVw8UmCExzOfNUlicQ5+bY8jjCTRA1vRcV17aHYgBOkC9u9WsAe85qstdX2FctFkmMmjK2LvoWgkV3KV8LTGPzk0BUDzlWLjXAGdHg/vOiDZpVtOh3eEi+ivW1MKCkCAL9kk1HmziTd2OM7a1Wk/U5fYWkDmLkCU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; b=Npe9q+aZDnTZX7LwvycUVF6yQtfktw63TB2gFFRcZyWEG8VbR3LGIlNDC0YYbnSi+nethCmxAOa9VHvVQSPgqpBTiBZL4qzuGh2Jl4ZC5mfggErtc11R/bM2Ybld7/biItqMk9EXJMOpaf7EQnzuQMiusdezpWT+rYNUjE6hrFo= Received: by 10.67.100.12 with SMTP id c12mr212607ugm.28.1200061079211; Fri, 11 Jan 2008 06:17:59 -0800 (PST) Received: from ?192.168.0.116? ( [86.137.236.187]) by mx.google.com with ESMTPS id n3sm2255219gvf.16.2008.01.11.06.17.51 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Jan 2008 06:17:54 -0800 (PST) Cc: internals@lists.php.net Message-ID: <1A1C5E07-4057-4A36-8406-B0FB8BA14185@googlemail.com> To: Ryusuke SEKIYAMA In-Reply-To: Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v915) Date: Fri, 11 Jan 2008 14:17:49 +0000 References: X-Mailer: Apple Mail (2.915) Subject: Re: [PHP-DEV] [RFC] Square brackets shortcut From: foolistbar@googlemail.com (Geoffrey Sneddon) On 10 Jan 2008, at 10:07, Ryusuke SEKIYAMA wrote: > I'm tired to type "array()" many times. And I want to > declare arrays more easily. So I wrote the patch for > zend_language_parser.y which enables to declare arrays > with square brackets like some other languages. I don't think tiredness to type an extra five characters should be an =20= excuse to change the syntax. There are language specifically designed =20= to require the minimum number of characters to be typed =97 if this is a = =20 real concern, you'd be better off using one of them and not PHP. > There are three options: > > a) Commit square bracket array shortcut patch > keys and values are separated by colons. > ( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch ) > e.g. > $a =3D [1, 2, 3]; > $b =3D ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon']; Breaks from PHP's =3D> for no apparent reason (one character too many =20= character this time?), which is just confusing (that's an implicit -1). > b) Commit square bracket array shortcut patch > keys and values are separated by double arrows. > ( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch ) > e.g. > $a =3D [1, 2, 3]; > $b =3D ['foo' =3D> 'orange', 'bar' =3D> 'apple', 'baz' =3D> = 'lemon']; Breaks backwards compatibility to save typing five characters. See =20 above. -1. > c) Reject and keep using `array()'. > e.g. > $a =3D array(1, 2, 3); > $b =3D array('foo' =3D> 'orange', 'bar' =3D> 'apple', 'baz' =3D> = 'lemon'); For all the above reasons, +1. -- Geoffrey Sneddon