Le 12 oct. 2012 10:37, "Bernhard Schussek" <bschus...@gmail.com> a écrit :
> > As I said, both syntaxes can work together. For example:
> >   public:protected $a {
> >     get() { return ($this->_prefix . $this->_a); }
> >     set($val) { $this->_a = substr($val, 1); }
> >   }
>
> A shortcoming of this syntax is that it does not offer a solution for
> the isset() and usset() accessors. Different visibility syntaxes for
> get/set and isset/unset would be unlogical and confusing.

Yes, you're right. But I never ever felt the need to define specific
visibility for __isset. On the other hand, I'm using getters and setters
everyday to manage the visibility of my object's attributes. (more about
isset and unset at the end of this email)

I'm trying to solve the main situation, not the special case.

> Also, public:protected implies an order which does not have to be kept
> in the block AFAIK. What is public and what is protected?

Read it aloud.

  public $a { protected set; }

«$a is publicly readable, and protected against writing.»

Exactly the same:

  public:protected $a;

«public read, protected write $a»

Seems easy to understand.

> public:protected $a { // ???
>     protected isset() { ... }
>     private unset() { ... }
>     get() { ... }
>     set($value) { ... }
> }

I consider that isset() is covered by the attribute's reading visibility,
and unset() is covered by writing visibility. If it's not obvious for you
as it is for me, can you give me some code examples?

Reply via email to