Re: Property Accessors v1.2

From: Date: Tue, 16 Oct 2012 11:06:36 +0000
Subject: Re: Property Accessors v1.2
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-63457@lists.php.net to get a copy of this message
Excuse my late-night-influenced terminology, the word "empty" is much more suitable than "does not have". And this "solution" really is more of a hack or work-around than a solution. I do think that there is a better way to go about implementing read/write-only, but nothing has come to mind as of yet - at least nothing that doesn't completely change major aspects of this RFC. On Tue, Oct 16, 2012 at 3:59 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote: > Hi! > > > 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. > > It does have a body. This body is just default empty method body > returning null - which does not throw any exceptions and is completely > indistinguishable from the outside from property being equal to null. > I'm not sure it's what the intent of *-only variable is, though I guess > it is a way to hack around it. I wonder however if it can be done better. > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 >

« previous php.internals (#63457) next »