Link us to a http://gist.github.com paste please Yasou. Thanks.

On Sat, Nov 19, 2011 at 9:45 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
> It seems gmail broke newlines :(
> but you'll see the idea.
>
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net
>
>
>
> 2011/11/20 Yasuo Ohgaki <yohg...@ohgaki.net>:
>> This is not a alternate syntax suggestion, but a currently working
>> solution (well partial)
>>
>> <?phptrait Accessors{  public function __get($name) {    if
>> ($this->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 = $value;  else     trigger_error("Access to write
>> protected property");}}
>> class OrderLine{  use Accessors;
>>  private $r_property = array('price'=>1, 'amount'=>1);  private
>> $w_property = array('price'=>1, 'amount'=>1);
>>  protected $price;  private $amount;
>>  public function getTotal() {    return $this->price * $this->amount;  }}
>> $line = new OrderLine;
>> $line->price = 20;$line->amount = 3;
>> echo "Total cost: ".$line->getTotal();?>
>>
>> You might would like to add as a current solution.
>>
>> --
>> Yasuo Ohgaki
>> yohg...@ohgaki.net
>>
>>
>>
>> 2011/11/19 Clint M Priest <cpri...@zerocue.com>:
>>> 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.  It 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 within a 
>>> getter/setter would cause it to access the parent getter/setter but that 
>>> 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
>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to