[squeak-dev] Re: Circular definitions of size and do:

Rodney Polkinghorne rpolkinghorne at groupwise.swin.edu.au
Mon Oct 3 03:51:12 UTC 2011


>> Is this considered a bug, or a learning experience for new players?

By "this", I meant the consequence of my error (expected "Error: Foo
needs a method for size", got a hung image), and the effort required
to find its cause.  I agree with Eliot's suggestion, that
SequenceableCollection>>size should raise an error.

> You should not instantiate an abstract class.

To follow that advice, I'd need a way to find out which classes were
abstract, and when I'd implemented enough methods to stop them being
abstract.  That seems to be a black art in Smalltalk.

There are two ways I could have written this.  One is to define a
subclass of Collection, and use the built-in collect:, inject:into:
and so on.  The other is to subclass Object, and define the iterators
that I was going to use.  Which approach is more common?

Rodney



More information about the Squeak-dev mailing list