Michael,
On 31 Oct 2013, at 11:00, Michael Paap <
[hidden email]> wrote:
> Hello list,
>
> in our OOP course we noticed some behaviour of an abstract method, which I cannot explain. Maybe you can help me:
>
> If I do the following
>
> SequenceableCollection new add: 123
>
> I would expect an Error. The method add: is not implemented in SequenceableCollectionbut inherited from collection, where it's only statement is
>
> self subclassResponsibility
>
> But in reality, Pharo seems to enter an endless loop, consuming more and more memory.
>
> Can someone please explain to me, what happens here?
>
> Greetings,
> Michael
Obviously, abstract classes should not be instanciated, but in teaching this is bound to happen.
Now, the actual error happens in the environment (debugger, inspector, printString mechanisms): they see a collection and try to work with it, since it is an incomplete/degenerate one, things break/loop.
The following does work for example:
SequenceableCollection new isCollection.
The question is: should there be an explicit error message when an abstract class is instanciated, is that even possible ?
Sven