Am 19.11.2012 16:41 schrieb "Nikita Popov" <nikita....@gmail.com>:
>
> On Wed, Nov 14, 2012 at 5:24 PM, Patrick Schaaf <p...@bof.de> wrote:
>
>> class ... {
>>   no methodname();
>>    // or
>>   no $property;
>> }
>>
> Removing methods from an extending class is an LSP violation.

I see LSP as a best practise for class design, not as something a language
should enforce.

Also, the propsed "autmatic" use of that "no" mechanism to solve the
accessor vs. property precendence issue, wouldn't be an LSP violation by
itself.

Anyway, the use case I sometimes had for that feature wouldn't even violate
LSP. I occasionaly have a subclass which likes to use a ___call magic
method to pass method calls on to a delegate object, and that does not work
for methods declared on the superclass in any way, be it as "throw
subclassresponsibility()" methods or some kind of default implementation
that other sibling classes would profit from. The only way out now is to
leave out such methods in the superclass, put them into a trait,  and use
that trait in all subclasses that do not want to delegate.

best regards
  Patrick

Reply via email to