Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50675 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19780 invoked from network); 28 Nov 2010 23:18:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2010 23:18:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=president@basnetworks.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=president@basnetworks.net; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain basnetworks.net from 208.97.132.177 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: president@basnetworks.net X-Host-Fingerprint: 208.97.132.177 caiajhbdcbhh.dreamhost.com Linux 2.6 Received: from [208.97.132.177] ([208.97.132.177:51335] helo=homiemail-a17.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/84-18134-153E2FC4 for ; Sun, 28 Nov 2010 18:18:42 -0500 Received: from homiemail-a17.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a17.g.dreamhost.com (Postfix) with ESMTP id A44897A805C for ; Sun, 28 Nov 2010 15:18:38 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=basnetworks.net; h=message-id :date:subject:from:to:mime-version:content-type: content-transfer-encoding; q=dns; s=basnetworks.net; b=mBVQExdkq vpquvMq2lnUqnj1b5X5VgBBx+NtK/yVlFgCCerL3gICrxEAxDlY/5W6PqOhutnL2 8cyXyrbc8noybtgKjAPSiVJJBUMovixgp93QPAw4j/wlz9tvMw5Sw9Hnj7vPeReG RV1Fw5fjTVfkt7ZSzqkhb5lO9QDFqSWsfc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=basnetworks.net; h= message-id:date:subject:from:to:mime-version:content-type: content-transfer-encoding; s=basnetworks.net; bh=P2URnRjthztE403 oSXkTvt0pO84=; b=K92rfavjUACkV2jqLkdEUFbqzDqTowpfxxqYZcguB1cSVWs JDUn5KNpmV0UEcBtzP/EtnoCIfpy80ry9yGxo7tUOp0bSV1+Ba0pg0VQso66pbw8 Kr5r/gajPrloyovBM5qNER2I3grjghm4nIrHPN6tjqNAt5U9N8+iNqN9rNR0= Received: from webmail.basnetworks.net (ahfbbjcaiaae.dreamhost.com [75.119.208.4]) (Authenticated sender: president@basnetworks.net) by homiemail-a17.g.dreamhost.com (Postfix) with ESMTPA id 814207A8058 for ; Sun, 28 Nov 2010 15:18:38 -0800 (PST) Received: from 69.196.170.173 (proxying for 69.196.170.173) (SquirrelMail authenticated user president@basnetworks.net) by webmail.basnetworks.net with HTTP; Sun, 28 Nov 2010 18:18:40 -0500 Message-ID: Date: Sun, 28 Nov 2010 18:18:40 -0500 To: internals@lists.php.net User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: RFC: C-sharp style property get/set syntax for PHP From: president@basnetworks.net Hello, This is my first time using a mailing list, so please bear with me. Some time back I suggested that PHP should have a property get/set syntax similar to that of Microsoft's C# language. One of the PHP developers suggested that if I were serious about it, I should write an RFC. I have done just that, and I would now like to present my RFC to everyone here i= n internals, in order to start a discussion on the topic. The RFC: Many modern languages have a special syntax for writing get/set method pairs. All that PHP currently supports is __get and __set, which while great for writing generic get/set methods is nearly useless when it comes to individual properties. Our only other choice is the age old process o= f writing custom class methods to make our get/set methods. Not only does this lack any kind of uniformity, but it also complicates the syntax ($foo->getBar() and $foo->setBar('baz') instead of $foo->bar and $foo->bar=3D'baz'). I believe that if PHP is going embrace modern object-oriented design, including encapsulation, than it needs a modern solution to property getters and setters. I wont add much more here, but rather let the RFC itself do the talking.=20 It is fairly well fleshed out, and should explain everything clearly enough. Link to the RFC: http://wiki.php.net/rfc/propertygetsetsyntax Thanks, Dennis Robinson