Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47663 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53255 invoked from network); 27 Mar 2010 18:16:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2010 18:16:33 -0000 X-Host-Fingerprint: 79.165.172.25 unknown Received: from [79.165.172.25] ([79.165.172.25:14902] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/76-22155-18B4EAB4 for ; Sat, 27 Mar 2010 13:16:33 -0500 Message-ID: <28.76.22155.18B4EAB4@pb1.pair.com> To: internals@lists.php.net Date: Sat, 27 Mar 2010 21:16:29 +0300 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3 MIME-Version: 1.0 References: <1269709768.7944.17.camel@guybrush> In-Reply-To: <1269709768.7944.17.camel@guybrush> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 79.165.172.25 Subject: Re: [PHP-DEV] Proposal: shorthand object property setting syntax. From: toorion@gmail.com (Toorion) On 03/27/2010 08:09 PM, Johannes Schlüter wrote: > You can always use a (temporary) alias to shorten things > > $myLongNameObject = new MyLongNameObject(); > $t = $myLongNameObject; > $t->property1 = '11111'; > $t->property2 = '22222'; > $t->property3 = '33333'; > $t->property4 = '44444'; > $t->property5 = '55555'; > unset($t); Yes, I use this and I should in any way (with shorthand syntax too), but, how I describe one post before - It help not a much. This just a short sample of code. In big code anyway no readable. > That won't work easily as there's a conflict between other local > variables. So this might only work with very specific expressions,which > is then mostly useless. Syntax-wise it /could/ work like this: > > with ($MyLongNameObject) { > ->property1 = '1111'; > ->property2 = '2222'; > } Ok, I just describe idea, but not an implementation. > but there's no big benefit over an alias but way more confusion with a > new syntax, a new keyword, ... Unfortunately for UI plenty of code is necessary. And in future more web application will be use Dynamic UI. And it is tendency - use server side generator for client side dynamic UI - here is many advantage - No needed work directly with DOM+CSS+HTML+JavaScript, which distinguish from one browser to other, It let change UI to user - from administrative panel (with modify UI implementation) - in CMS, for example... So, I found this idea in JavaScript, when possible to initialize object like { attribute1 = value1, attribute2 = value2 } and it is very helpful. But much better use PHP UI framework, which produce HTML,CSS,JavaScript code, than write lot of code in many environment. Plus PHP OOP model much better than others.