On Wednesday 14 November 2012 16:35:31 Nikita Popov wrote:
> On Wed, Nov 14, 2012 at 2:27 PM, Clint Priest <cpri...@zerocue.com> wrote:
> > Been AWOL for a while and getting back to this, doesn't seem like any
> > resolution has occurred, just the conversation has died down.
> 
> I got the feeling that in the last few mails we actually made some progress
> and some people agreed with me that __magic accessor methods and a
> dedicated syntax for them are not combinable semantically. Maybe I got that
> wrong :/

I thought I'd made a proposal that would solve that problem, but maybe it was 
overlooked, or more likely too ugly to be recognized as such.

Requires a single new feature / syntax, that at least I find missing right 
now:

class ... {
  no methodname();
   // or
  no $property;
}

removing the specified thing from the class, with the possibility to then 
redefine it. Silently ignore this when the thing doesn't exist.

The mechanism for that could then be used to solve your semantic puzzle, using 
these rules:

- any ordinary property declaration for $foo internally also does
        no __prop_get_foo();
        no __prop_set_foo();
        no __prop_isset_foo();
        no __prop_unset_foo();
- any declaration of these four new magic methods internally also does
       no $foo;

In other words:

whenever a class implements one of the accessor magic methods, an inherited 
property is ignored, as if it wasn't present in the base class(es) in the 
first place.

And whenever a class declares a property in the ordinary way, any inherited 
magic property accessor methods are ignored, as if they were not present in 
the base class(es) in the first place.

Maybe a "final" in the respective base class, would make this attempt an 
ERROR.

What do you think? Should I try to write up an RFC for the "no" feature?

best regards
  Patrick

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

Reply via email to