Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52707 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18604 invoked from network); 1 Jun 2011 21:29:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2011 21:29:05 -0000 Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 74.125.83.170 mail-pv0-f170.google.com Received: from [74.125.83.170] ([74.125.83.170:39249] helo=mail-pv0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/B2-32367-F1FA6ED4 for ; Wed, 01 Jun 2011 17:29:04 -0400 Received: by pvh21 with SMTP id 21so108418pvh.29 for ; Wed, 01 Jun 2011 14:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=IvixORlHQqrpk2MVSpkDTrnP84hLMtRxQgUQD/w6YYo=; b=nKE2XY7/R/2UxVarlMxDbAQXLOCHkCB/VgyRzYq52qfOfXvw0htXHfCBTlOcuL15Sk 0Cxp9Lucm25DOBPPU3qIZNlB3oTb1NMQDqc/QZDst5WnVmwN6l8lQIiprWvt683MDfVI h+YdTrzFUBoLtWAA+XpPCZESKbg5GWivJZ+HI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=QUJWXJAPsEdkso+k7AtE+2mD0TZOtdfgH+hYSrfgEgdnH/jLMc0Tfcef8yE+fxwxcc aEtruLuok/J4YhgejQnFryCIc4KhqGDBA+p16URk1GBrcQTTaq0+MIfjw8eRLeYbutAU k9zs4urTy8vG21PWkIhGubRhHjURO17B0v5DE= MIME-Version: 1.0 Received: by 10.68.22.2 with SMTP id z2mr3261366pbe.428.1306963740585; Wed, 01 Jun 2011 14:29:00 -0700 (PDT) Received: by 10.68.63.162 with HTTP; Wed, 1 Jun 2011 14:29:00 -0700 (PDT) In-Reply-To: References: <4DE5368A.6050603@moonspot.net> <8BEEEE49-8DA3-4634-BF9C-120F7A15B613@roshambo.org> Date: Wed, 1 Jun 2011 14:29:00 -0700 Message-ID: To: Anthony Ferrara Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC: Short syntax for Arrays (redux) From: chrisstocktonaz@gmail.com (Chris Stockton) Hello, On Wed, Jun 1, 2011 at 2:17 PM, Anthony Ferrara wrote= : > Personally, I think focusing on a character savings is the wrong > reason to take on any problem. =A0I don't care how long it takes for me > to type code. =A0I don't care how much extra hdd space it takes. =A0But > what I do care about is how readable it is. > > To me, the array shortcut syntax is pointless. =A0Do you really mean to > tell me that `[1, 2]` is more readable/easier to understand than > `array(1,2)`? =A0To me, it's about a wash. > > However, the object shortcut syntax is a major win. =A0For example: > > $person =3D new stdClass(); > $person->city =3D 'ogden'; > $person->state =3D 'ut'; > $perspn->country =3D 'usa'; > $person->favoriteNumbers =3D array(4, 12, 37, 42); > $person->somethingWithNumbers(); > $person->unluckyNumbers =3D array(6, 13, 21); > $person->likesPhp =3D 'very much so'; > > vs > > $person =3D =A0{ 'name' =3D> 'Justin', > =A0 'city' =3D> 'ogden', > =A0 'state' =3D> 'ut', > =A0 'country' =3D> 'usa', > =A0 'favoriteNumbers' =3D> [ 4, 12, 37, 42], > =A0 'unluckyNumbers' =3D> [ 6, 13, 21], > =A0 'likesPhp' =3D> 'very much so' > } > > Did you notice what happened there? =A0There's two differences. =A0Try to > find them. =A0Neither would be possible with the shortcut syntax. > I don't think doing this is a very big deal, even in the case of Array(). $person =3D (object)=A0[ 'name' =3D> 'Justin', =A0 'city' =3D> 'ogden', =A0 'state' =3D> 'ut', =A0 'country' =3D> 'usa', =A0 'favoriteNumbers' =3D> [ 4, 12, 37, 42], =A0 'unluckyNumbers' =3D> [ 6, 13, 21], =A0 'likesPhp' =3D> 'very much so' ]