Re: Property Accessors v1.2

From: Date: Tue, 16 Oct 2012 10:51:42 +0000
Subject: Re: Property Accessors v1.2
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-63453@lists.php.net to get a copy of this message
I apologize for my confusing terminology - let me elaborate. There are no special syntaxes. The below code should help clear things up a bit: class MyClass { > private $otherProperty; > public $property { > get() {}; // Does not "have a body", as there is no code between the > curly braces. > set($value) { $this->otherProperty = $value; } // Does "have a body", > as there IS code between the curly braces. > } > } > On Tue, Oct 16, 2012 at 3:48 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote: > Hi! > > > Stas, the proposed "solution" thus far is to make the getter or setter > > final and private and not have a body. This would naturally throw an > > exception if it was accessed from anywhere but the class it was defined. > > The class it was defined in has to remember that it is virtually a > > read/write only accessor. > > What you mean by "not have a body" - is there special syntax for > body-less methods introduced? Then it should be in the RFC. How it is > implemented - what exactly is stored in the function table then? > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 >

« previous php.internals (#63453) next »