[squeak-dev] The Inbox: 60Deprecated-ct.80.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Aug 20 12:52:24 UTC 2020


Sorry for the overhasty commit storm. From what the old method comment in SequenceableCollection >> #doWithIndex: stated, I believed that the formal deprecation of this selector was already decided but never realized:


"Use the new version with consistent naming"


In my image, #doWithIndex: has 89 senders opposed to #withIndexDo: which has 156 senders. #doWithIndex: could be a confusing name because usually, the latest phrase before the argument specifies the role or type of the argument, but in this case, the argument is not an index, but a block.


Marcel said #withIndexDo: could be considered as confusing either because its name would not match the arguments in the expected block. However, I think it still matches the order because the element is already represented by the receiver of the MessageSend:


classes withIndexDo: [:class :index | ...]


Open to hear your opinions! However we decide, I think it would improve the overall Smalltalk experience to have a single preferred name for protocols like this one to clean up the things.


Best,

Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Donnerstag, 20. August 2020 14:39:58
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: 60Deprecated-ct.80.mcz

... just why?

Best,
Marcel

Am 20.08.2020 14:33:41 schrieb commits at source.squeak.org <commits at source.squeak.org>:

A new version of 60Deprecated was added to project The Inbox:
http://source.squeak.org/inbox/60Deprecated-ct.80.mcz

==================== Summary ====================

Name: 60Deprecated-ct.80
Author: ct
Time: 20 August 2020, 2:33:32.63864 pm
UUID: 1295269c-62ee-5c45-9315-e66ff5eef57a
Ancestors: 60Deprecated-mt.79

Finnaly deprecate #doWithIndex: and #collectWithIndex:. Other packages will be patched right now.

=============== Diff against 60Deprecated-mt.79 ===============

Item was added:
+ ----- Method: HashedCollection>>doWithIndex: (in category '*60Deprecated-enumerating') -----
+ doWithIndex: elementAndIndexBlock
+
+ self deprecated: 'Use #withIndexDo: instead'.
+ ^ self withIndexDo: elementAndIndexBlock!

Item was added:
+ ----- Method: SequenceableCollection>>collectWithIndex: (in category '*60Deprecated-enumerating') -----
+ collectWithIndex: elementAndIndexBlock
+
+ self deprecated: 'Use #withIndexCollect: instead'.
+ ^ self withIndexCollect: elementAndIndexBlock!

Item was added:
+ ----- Method: SequenceableCollection>>doWithIndex: (in category '*60Deprecated-enumerating') -----
+ doWithIndex: elementAndIndexBlock
+
+ self deprecated: 'Use #withIndexDo: instead'.
+ ^ self withIndexDo: elementAndIndexBlock!

Item was changed:
----- Method: StandardFileMenu>>menuSelectionsArray: (in category 'menu building') -----
menuSelectionsArray: aDirectory
"Answer a menu selections object corresponding to aDirectory. The object is an array corresponding to each item, each element itself constituting a two-element array, the first element of which contains a selector to operate on and the second element of which contains the parameters for that selector."

|dirSize|
dirSize := aDirectory pathParts size.
^Array streamContents: [:s |
canTypeFileName ifTrue:
[s nextPut: (StandardFileMenuResult
directory: aDirectory
name: nil)].
s nextPut: (StandardFileMenuResult
directory: (FileDirectory root)
name: '').
+ aDirectory pathParts withIndexDo:
- aDirectory pathParts doWithIndex:
[:d :i | s nextPut: (StandardFileMenuResult
directory: (self
advance: dirSize - i
containingDirectoriesFrom: aDirectory)
name: '')].
aDirectory directoryNames do:
[:dn | s nextPut: (StandardFileMenuResult
directory: (FileDirectory on: (aDirectory fullNameFor: dn))
name: '')].
aDirectory fileNames do:
[:fn | pattern do: [:pat | (pat match: fn) ifTrue: [
s nextPut: (StandardFileMenuResult
directory: aDirectory
name: fn)]]]]!

Item was changed:
----- Method: StandardFileMenu>>pathPartsString: (in category 'menu building') -----
pathPartsString: aDirectory
"Answer a string concatenating the path parts strings in aDirectory, each string followed by a cr."

^String streamContents:
[:s |
s nextPutAll: '[]'; cr.
+ aDirectory pathParts asArray withIndexDo:
- aDirectory pathParts asArray doWithIndex:
[:part :i |
s next: i put: $ .
s nextPutAll: part withBlanksTrimmed; cr]]!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200820/f8f7cad6/attachment.html>


More information about the Squeak-dev mailing list