[ENH] raok-CollectAccept

ok at cs.otago.ac.nz ok at cs.otago.ac.nz
Tue Jun 4 03:02:31 UTC 2002


from preamble:

"Change Set:		raok-CollectAccept
Date:			4 June 2002
Author:			Richard A. O'Keefe

This adds the methods
	#accepts: candidateValue
	#acceptsKey: candidateIndex
	#accepts: value key: key

to Collection and some of its descendants.  The
historic reason for this is that I was criticising
the design of the Java 1.2 collection classes to a
group of students when I realised that the Squeak
collection classes shared one of the defects.  Some
collections reject certain elements, but there is no
way to find out which.  For example, you can
add: nil to an OrderedCollection, but not to a Set.
(Let's be honest, there are Set implementations
which would not have this limitation.)  Yet there
was no way to ask 'would rcvr add: nil work'
without actually trying it.  As I worked through
the predefined classes adding these methods, I found
another reason for having them:  documentation.
I now regard these methods as useful for telling
human readers what is allowed, even if they were
never called."!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raok-CollectAccept.cs.gz
Type: application/octet-stream
Size: 2409 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020604/77271fd6/raok-CollectAccept.cs.obj


More information about the Squeak-dev mailing list