Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56437 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11474 invoked from network); 19 Nov 2011 21:44:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2011 21:44:20 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:63661] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/E0-03486-23328CE4 for ; Sat, 19 Nov 2011 16:44:19 -0500 Received: by yenl2 with SMTP id l2so4129205yen.29 for ; Sat, 19 Nov 2011 13:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=K3cUq1Ya58uzPfVY75aQIJ1hNNxfMRtsCQtxiv5U6xc=; b=rteBkmSEoTw/UimtO8CnYAFWKIvnf7OHZvONR81mbtUgQTMqVaPe8malEMC34ZdpZS vnHQL7aX/Ey4zJjIqtd+Bza2p9jw7QNKtKsQT9hDniU4mDEgOtHQOXxsEqvYN+Ce6c22 n8Lk2i0cUjSSM1OtXKkUcL5N9zFJK4tVlIo94= Received: by 10.236.77.72 with SMTP id c48mr12294629yhe.55.1321739055094; Sat, 19 Nov 2011 13:44:15 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.100.127.18 with HTTP; Sat, 19 Nov 2011 13:43:34 -0800 (PST) In-Reply-To: <9570D903A3BECE4092E924C2985CE485399328B6@MBX201.domain.local> References: <9570D903A3BECE4092E924C2985CE485399328B6@MBX201.domain.local> Date: Sun, 20 Nov 2011 06:43:34 +0900 X-Google-Sender-Auth: dpqgVet0HPLzutOFAmPr1Nfhcqo Message-ID: To: Clint M Priest Cc: "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Getters/Setters and parent getter/setter access From: yohgaki@ohgaki.net (Yasuo Ohgaki) This is not a alternate syntax suggestion, but a currently working solution (well partial) r_property[$name]) return $this->$name; else trigger_error("Access to read protected property");} public function __set($name, $value) { if ($this->w_property[$name]) $this->$name =3D $value; else=A0 trigger_error("Access to write protected property");}} class OrderLine{ use Accessors; private $r_property =3D array('price'=3D>1, 'amount'=3D>1); private $w_property =3D array('price'=3D>1, 'amount'=3D>1); protected $price; private $amount; public function getTotal() { return $this->price * $this->amount; }} $line =3D new OrderLine; $line->price =3D 20;$line->amount =3D 3; echo "Total cost: ".$line->getTotal();?> You might would like to add as a current solution. -- Yasuo Ohgaki yohgaki@ohgaki.net 2011/11/19 Clint M Priest : > The RFC here: https://wiki.php.net/rfc/propertygetsetsyntax > > Talks about allowing a sub-class to access a parent getter via TimePeriod= ::$Milliseconds or possibly parent::$Milliseconds. > > Either of those methods (currently) tries to access a static property in = the parent or defined class. =A0It would probably break existing code if we= tried to make the parent:: or TimePeriod:: syntax to access the parent acc= essor. > > Anyone have any suggestions on an alternative syntax? > > I'm sure I could change it so that parent:: or TimePeriod:: from within a= getter/setter would cause it to access the parent getter/setter but that w= ould create an inconsistency within the language. > > Ideas? > > -Clint >