On 30 Mar 2019, at 21:05, Denis Kudriashov wrote:

We can also look into it from the other side. All these methods are
definitely a kind of code duplication.
I think what we need here is an explicit property for classes. It could be
even part of class definition.

I'm not sure whether that's the right thing to do but I definitely like where you're going. BTW, class initialization via Monticello (class side #initialize) also doesn't use inheritance (although I've always considered that a bug). I.e., Monticello only evalutes #initialize on the class that installed the #initialize method and not on any subclass. Maybe a general mechanism for marking a class as abstract could also include a mechanism to "override" method lookup.

Just some thoughts.

Max

BTW do we plan new class definition in Pharo 8?

сб, 30 мар. 2019 г. в 18:35, Denis Kudriashov <dionisi...@gmail.com>:

Hello.

We did recently several cleanups by marking abstract classes as abstract using #isAbstract method (https://github.com/pharo-project/pharo/pull/3087
, https://github.com/pharo-ide/Calypso/pull/462) .

I would like to discuss here and decide what the right way to implement
this method.

The logic behind is to only return true when receiver is defining class of this method. And it should be false for any subclasses (if they do not
implement own #isAbstract method).

There is old pattern for implementation to compare name of class:

MyAbstractClass class>>isAbstract
      ^self name == #MyAbstractClass


It is used in many places (mostly tests). And it was used in recent Pharo
PR (3087).

We have another pattern in other places which simply compare self with
class:

MyAbstractClass class>>isAbstract
      ^self == MyAbstractClass


And in Calypso I used "more simplified" version using equality:

MyAbstractClass class>>isAbstract
      ^self = MyAbstractClass

I think we would all agree that simplest version is last one. It does not
raise any question about why we compare name or why we use identity
comparison. So this is my choice in this discussion.

Please write arguments about your preferred implementation. And let's
choose single way at the end. There is an idea to add a command into
browser to make classes abstract. And this decision will be used as a
template.


Best regards,
Denis





Reply via email to