Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47657 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18889 invoked from network); 27 Mar 2010 16:29:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2010 16:29:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 85.88.12.247 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 85.88.12.247 toolslave.net Received: from [85.88.12.247] ([85.88.12.247:33942] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/84-20638-5723EAB4 for ; Sat, 27 Mar 2010 11:29:41 -0500 Received: from cust194-138.dsl.as47377.net ([62.166.194.138] helo=[192.168.0.16]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1NvYtA-0000yE-IH; Sat, 27 Mar 2010 17:29:36 +0100 Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii In-Reply-To: <4BAE30F7.5090004@divbyzero.net> Date: Sat, 27 Mar 2010 17:29:27 +0100 Cc: Toorion , internals@lists.php.net Content-Transfer-Encoding: 7bit Message-ID: <73954AEC-89FA-4552-81DD-2B4E019B5DD4@stefan-marr.de> References: <4BAE30F7.5090004@divbyzero.net> To: Martin Jansen X-Mailer: Apple Mail (2.1077) Subject: Re: [PHP-DEV] Proposal: shorthand object property setting syntax. From: php@stefan-marr.de (Stefan Marr) 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... However, the proposal reminds me of Pascal's 'with'-construct: http://en.wikipedia.org/wiki/Pascal_(programming_language) new(pointertob); with pointertob^ do begin a := 10; b := 'A'; c := nil end; > > - Martin > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525