Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47658 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20873 invoked from network); 27 Mar 2010 16:39:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2010 16:39:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=martin@divbyzero.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=martin@divbyzero.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain divbyzero.net from 87.230.111.147 cause and error) X-PHP-List-Original-Sender: martin@divbyzero.net X-Host-Fingerprint: 87.230.111.147 mx.bauer-kirch.de Linux 2.6 Received: from [87.230.111.147] ([87.230.111.147:40490] helo=mx.bauer-kirch.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9E/D4-20638-6C43EAB4 for ; Sat, 27 Mar 2010 11:39:34 -0500 Received: by mx.bauer-kirch.de with ESMTP id 1NvZ2n-0008AF-HV; Sat, 27 Mar 2010 17:39:30 +0100 Message-ID: <4BAE34BE.8080409@divbyzero.net> Date: Sat, 27 Mar 2010 17:39:26 +0100 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Stefan Marr CC: Toorion , internals@lists.php.net References: <4BAE30F7.5090004@divbyzero.net> <73954AEC-89FA-4552-81DD-2B4E019B5DD4@stefan-marr.de> In-Reply-To: <73954AEC-89FA-4552-81DD-2B4E019B5DD4@stefan-marr.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Proposal: shorthand object property setting syntax. From: martin@divbyzero.net (Martin Jansen) On 27.03.10 17:29, Stefan Marr wrote: > > On 27 Mar 2010, at 17:23, Martin Jansen wrote: > >> On 27.03.10 17:02, Toorion wrote: >>> $myLongNameObject = new MyLongNameObject(); >>> $myLongNameObject->property1 = '11111'; >>> $myLongNameObject->property2 = '22222'; >>> $myLongNameObject->property3 = '33333'; >>> $myLongNameObject->property4 = '44444'; >>> $myLongNameObject->property5 = '55555'; >> >> [...] >> >>> $MyLongNameObject = new MyLongNameObject() { >>> $property1 = '1111'; >>> $property2 = '2222'; >>> $property3 = '4444'; >>> $property4 = '5555'; >>> } >> >> What exactly do you gain with the new syntax? You don't save LOC with >> it (actually it requires one more line) and you still have to type all >> the property names. Using an editor with code completion one can >> produce the code in the current syntax pretty quickly after all. > LOC isn't a very useful metric anyway... Of course. I was primarily referring to Toorion's assertion that the new syntax is less time-consuming. In doing so I assumed that typing N lines of code consume less time than typing N+1. :) > However, the proposal reminds me of Pascal's 'with'-construct: > > new(pointertob); > > with pointertob^ do > begin > a := 10; > b := 'A'; > c := nil > end; Can one do something like "b := this.a"? This sounds like a huge can of worms to me. - Martin