[squeak-dev] Towards a more consistent and sensible implementation of #isAbstract

Tobias Pape Das.Linux at gmx.de
Fri Dec 8 10:12:53 UTC 2017


Hi
> On 08.12.2017, at 09:54, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
> 
> I had the same question.
> The case I had in mind when using = was:
> 
>     ArrayedCollection copy isAbstract.
> 
> No reason that it would not be abstract right?
> Since = is inherited from Object and uses ==, it does not make a great difference currently...
> Nevertheless, I let = for not insulting the future.
> 
> But if one wants to use == everywhere, I have no serious objection.
> 

I remember that for a portable solution (targetting a very old GemStone), I had to resort to the following strangeness:

MyTestCase
isAbstract
	^ self name asString = 'MyTestCase'

Don't ask me why :D

Nevertheless, I'd actually like to not spell out the class name (b.c. of future renamings)
but since that is impossible to do practically, I'm fine with either #= or #==.
Consensus seems to be #==, so lets go with consistency and make them all #==

Best regards
	-Tobias

> 
> 2017-12-08 7:15 GMT+01:00 H. Hirzel <hannes.hirzel at gmail.com>:
> This looks like a useful cleanup
> 
> Many cases are like this
> 
> ArrayedCollection
> isAbstract
>         ^self = ArrayedCollection
> 
> 
> So
> 
> isAbstract
>         ^self == ArrayedCollection
> 
> 
> is a better solution
> 
> --Hannes
> 
> On 12/7/17, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
> > Hi, there.
> >
> > What are your thoughts on how to implement "MyClass class >> #isAbstract"? I
> > think that one should always use #== and compare it to an actual class
> > object like this:
> >
> > MyClass class >> #isAbstract
> >    ^ self == MyClass
> >
> > At the time of writing, we have various attempts in your image. You can
> > browse them easily:
> >
> >
> > Best,
> > Marcel
> 
> 
> 



More information about the Squeak-dev mailing list