Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56440 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29468 invoked from network); 20 Nov 2011 00:26:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Nov 2011 00:26:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; 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:63447] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/11-17754-64948CE4 for ; Sat, 19 Nov 2011 19:26:47 -0500 Received: by yenl2 with SMTP id l2so4189214yen.29 for ; Sat, 19 Nov 2011 16:26:44 -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=YqYhmEcokJhHoKCUENV849amjWSaVX8E95OYWZa6lfc=; b=v1cXqLoyX8tHriuiLM5e8hiDmQ2CgHOJioogKT52w1D7lBx/v9VOoc5xBqWvK3A7o2 mg/nVQqN65L8CAY5IWT/sIaGNYVFFIMzsvkH296WNsdzrjqdd7n+a2mSoWgU4QWkjjRp td/SiWTjhBCWQgVTSNUyNk9gxSIgEJVqxVOcE= Received: by 10.236.78.229 with SMTP id g65mr13289420yhe.4.1321748804078; Sat, 19 Nov 2011 16:26:44 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.100.127.18 with HTTP; Sat, 19 Nov 2011 16:26:03 -0800 (PST) In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485399328B6@MBX201.domain.local> Date: Sun, 20 Nov 2011 09:26:03 +0900 X-Google-Sender-Auth: MRQzrPuCwlSH60MAyyvM6E1uccc Message-ID: To: Paul Dragoonis Cc: Clint M Priest , "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) Sure. I did. https://gist.github.com/1379592 -- Yasuo Ohgaki yohgaki@ohgaki.net 2011/11/20 Paul Dragoonis : > Link us to a http://gist.github.com paste please Yasou. Thanks. > > On Sat, Nov 19, 2011 at 9:45 PM, Yasuo Ohgaki wrote: >> It seems gmail broke newlines :( >> but you'll see the idea. >> >> -- >> Yasuo Ohgaki >> yohgaki@ohgaki.net >> >> >> >> 2011/11/20 Yasuo Ohgaki : >>> This is not a alternate syntax suggestion, but a currently working >>> solution (well partial) >>> >>> >> ($this->r_property[$name]) =A0 =A0 =A0return $this->$name; =A0 =A0else >>> trigger_error("Access to read protected property");} >>> public function __set($name, $value) { =A0if ($this->w_property[$name]) >>> =A0 $this->$name =3D $value; =A0else=A0 =A0 =A0trigger_error("Access to= write >>> protected property");}} >>> class OrderLine{ =A0use Accessors; >>> =A0private $r_property =3D array('price'=3D>1, 'amount'=3D>1); =A0priva= te >>> $w_property =3D array('price'=3D>1, 'amount'=3D>1); >>> =A0protected $price; =A0private $amount; >>> =A0public function getTotal() { =A0 =A0return $this->price * $this->amo= unt; =A0}} >>> $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 TimePer= iod::$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 = accessor. >>>> >>>> Anyone have any suggestions on an alternative syntax? >>>> >>>> I'm sure I could change it so that parent:: or TimePeriod:: from withi= n a getter/setter would cause it to access the parent getter/setter but tha= t would create an inconsistency within the language. >>>> >>>> Ideas? >>>> >>>> -Clint >>>> >>> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >