<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi Chris,<div><br></div><div>you sketch a rather broad scope for potential frameworks. While I cannot foresee the kind of frameworks that will be created in the future, I suspect that composition (instead of inheritance or extension methods) is a good fit for many scenarios out there. And composition has been successful for integrating collections into applications and frameworks in the past such as Morphic's submorphs. For Object, I do see your point, one has to subclass and might then be annoyed by existing -- simple -- selectors such as #name.</div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 15.05.2019 02:38:55 schrieb Chris Muller <asqueaker@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">Hi Marcel,
<br>
<br>The word "take" has a several different meanings and uses.  It's
<br>possible this selector would exist in certain frameworks for different
<br>purposes.  If, in one of these apps or frameworks, it existed in the
<br>form of a general behavior for any Object, including Collections, then
<br>it would become problematic for their framwork or app to be installed
<br>in Squeak, and, worse, if other methods internal to Squeak were to
<br>start depending on #take:, then the framework wouldn't be able to
<br>replace it.
<br>
<br>This is why I generally prefer to leave these kinds of broad words out
<br>of the API as much as possible, so it can be "given" to apps for
<br>whatever their interpretation would be of those words.
<br>
<br>Just my 2-cents.
<br>
<br>Best,
<br>  Chris
<br>
<br>PS -- we do have a lot of methods which utilize the "upTo"
<br>nomenclature.  Could we integrate that in any way for consistency and
<br>specificity?
<br>
<br>On Mon, May 13, 2019 at 2:46 AM <commits@source.squeak.org> wrote:
<br>>
<br>> A new version of Collections was added to project The Inbox:
<br>> http://source.squeak.org/inbox/Collections-mt.833.mcz
<br>>
<br>> ==================== Summary ====================
<br>>
<br>> Name: Collections-mt.833
<br>> Author: mt
<br>> Time: 13 May 2019, 9:46:28.73801 am
<br>> UUID: 44057ed3-9b55-0b49-8472-71d5c3fdbeeb
<br>> Ancestors: Collections-mt.832
<br>>
<br>> Second iteration of #take: (and #any:). #any: relates to #anyOne and thus signals an error if the collection is not large enough. #take: uses #any: but accounts for smaller collections.
<br>>
<br>> =============== Diff against Collections-mt.832 ===============
<br>>
<br>> Item was added:
<br>> + ----- Method: CharacterSet>>any: (in category 'accessing') -----
<br>> + any: numberOfElements
<br>> +
<br>> +       ^ self any: numberOfElements as: Array!
<br>>
<br>> Item was added:
<br>> + ----- Method: CharacterSet>>any:as: (in category 'accessing') -----
<br>> + any: numberOfElements as: aClass
<br>> +
<br>> +       self canBeEnumerated
<br>> +               ifTrue: [^ super any: numberOfElements as: aClass]
<br>> +               ifFalse: [self shouldNotImplement]!
<br>>
<br>> Item was removed:
<br>> - ----- Method: CharacterSet>>take: (in category 'accessing') -----
<br>> - take: n
<br>> -
<br>> -       self shouldNotImplement.!
<br>>
<br>> Item was added:
<br>> + ----- Method: Collection>>any: (in category 'accessing') -----
<br>> + any: numberOfElements
<br>> +
<br>> +       ^ self any: numberOfElements as: self species!
<br>>
<br>> Item was added:
<br>> + ----- Method: Collection>>any:as: (in category 'accessing') -----
<br>> + any: numberOfElements as: aClass
<br>> +       "Enumerate this colleciton and return the specified number of elements. Signals an error if this collection has not enough elements."
<br>> +
<br>> +       | index result |
<br>> +       index := 0.
<br>> +       result := aClass new: numberOfElements.
<br>> +
<br>> +       result fillFrom: self with: [:each |
<br>> +               (index := index + 1) > numberOfElements
<br>> +                       ifTrue: [^ result]
<br>> +                       ifFalse: [each]].
<br>> +
<br>> +       index = numberOfElements
<br>> +               ifFalse: [self error: 'Not enough elements in this collection.'].
<br>> +
<br>> +       ^ result!
<br>>
<br>> Item was changed:
<br>>   ----- Method: Collection>>take: (in category 'accessing') -----
<br>> + take: maxNumberOfElements
<br>> +       "Returns maxNumberOfElements as a new collection or less if the collection is not large enough."
<br>> - take: n
<br>> -       "Enumerate this collection and return the first n elements or less."
<br>>
<br>> +       ^ self any: (maxNumberOfElements min: self size)!
<br>> -       | index result |
<br>> -       index := 1.
<br>> -       result := self species new: (n min: self size).
<br>> -       self associationsDo: [:each |
<br>> -               result add: each.
<br>> -               (index := index + 1) > n ifTrue: [^ result]].
<br>> -       ^ result!
<br>>
<br>> Item was added:
<br>> + ----- Method: SequenceableCollection>>any: (in category 'accessing') -----
<br>> + any: numberOfElements
<br>> +
<br>> +       ^ self first: numberOfElements!
<br>>
<br>> Item was removed:
<br>> - ----- Method: SequenceableCollection>>take: (in category 'accessing') -----
<br>> - take: n
<br>> -
<br>> -       ^ self first: (n min: self size)!
<br>>
<br>> Item was added:
<br>> + ----- Method: Stream>>any: (in category 'accessing') -----
<br>> + any: numberOfElements
<br>> +       "See Collection protocol."
<br>> +
<br>> +       ^ self next: numberOfElements!
<br>>
<br>> Item was changed:
<br>>   ----- Method: Stream>>take: (in category 'accessing') -----
<br>> + take: maxNumberOfElements
<br>> +       "See Collection protocol."
<br>> +
<br>> +       ^ self any: maxNumberOfElements!
<br>> - take: n
<br>> -
<br>> -       ^ self next: n!
<br>>
<br>>
<br></commits@source.squeak.org></div></blockquote></div>