[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: meaning of Collection>>#copyEmpty:

From: Paolo Bonzini
Subject: [Help-smalltalk] Re: meaning of Collection>>#copyEmpty:
Date: Mon, 11 Dec 2006 10:10:11 +0100
User-agent: Thunderbird (Macintosh/20061025)

Clearly, this has a different meaning when the argument to new: is treated as a capacity. Furthermore, is #(nil nil nil nil nil) considered an empty Array?

As empty as possible, given that Array is not extensible.

I recently discovered that, due to this discrepancy, OrderedCollections cannot be used as contents of WriteStreams. This isn't a major problem, because WriteStreams are after all designed to do the extra work that OrderedCollections do for you. And Squeak, at least, shares this "feature".

I suppose my real question is whether this method can be rewritten in a way such that it would work sensibly for OrderedCollections without expanding the Collection protocol or doing explicit isKindOf: tests? -- not that I would recommend replacing this perfectly sensible implementation for such a silly purpose at all:

I don't follow you really, but if you propose a patch to make WriteStreams work on extensible collections, I'll be happy to review it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]