Renaming newEmpty/newSize: to new &capacity:

Brian Rice water at tunes.org
Sun Jan 30 08:38:02 PST 2005


No, it's not too abstract. Capacity refers to a "hint" to the 
collection that it needs space for so-and-so many elements. The 
collection can ignore it at will, which is what makes it a perfect 
candidate for optional parameters, and capacity is already a distinct 
variable from size. A collection's size is the number of elements it 
contains. A collection's capacity is the number it /can/ contain 
without growing (for trees, it is LargeUnbounded, for obvious reasons).

We have a unit library (src/lib/dimensioned.slate) which will not be 
used for something this basic. "Units" are just indexable slots in this 
case. #sizeInBytes just shows that you are thinking at totally the 
wrong abstraction level.

This has also been well-tested in several other collection libraries.

On Jan 29, 2005, at 9:30 PM, Shaping wrote:

> #capacity is too abstract.  #newSize: and #size are correct in the 
> general sense
> of countable units.  If you want to designate a count of specific 
> units, append
> this modifier, prepositionally, as in:  #sizeInBytes.
>
> Shaping
>
> ----- Original Message ----- From: "Brian T. Rice" <water at tunes.org>
> To: <slate at tunes.org>
> Sent: Monday, January 17, 2005 20:07
> Subject: Renaming newEmpty/newSize: to new &capacity:
>
>
>> Hello,
>>
>> This is a quick notification of a change, and a poll as to whether 
>> this
>> suggested renaming has any objections - I am considering altering the
>> collection protocol so that #newEmpty and #newSize: will just be 
>> keyword
>> variations on a method #new, the keyword being "capacity" since size 
>> is a
>> misnomer.
>>
>> This has been under consideration for a long time, and we can keep 
>> the old
>> methods in the image for another sub-point release for convenience, 
>> but it
>> will require a full bootstrap and a ton of selector replacements in 
>> the
>> source code (this is not hard, but can be a nuisance for 
>> contributors).
>>
>> Any comments/suggestions?
>>
>> -Brian
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list