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]]!
... just why?
Best, Marcel Am 20.08.2020 14:33:41 schrieb commits@source.squeak.org commits@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]]!
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@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@source.squeak.org commits@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]]!
Thank you for this explanation. Would have made a great commit message ;-)
Also thanks for the highlighted example. Never thought of it that way. Makes sense.
Best, Marcel Am 20.08.2020 14:52:33 schrieb Thiede, Christoph christoph.thiede@student.hpi.uni-potsdam.de: 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@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@source.squeak.org commits@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]]!
I have stopped to commit the patches to all affected packages, which was a terrible idea as I recognize now. In case we can agree on deprecating #doWithIndex:, I am attaching the corresponding changeset.
FWIW, here is the snippet I used to rename all senders of the deprecated selectors:
oldSelector := #collectWithIndex:. newSelector := #withIndexCollect:.
methods := self systemNavigation allCallsOn: oldSelector. methods do: [:method | method actualClass compile: (method sourceCode copyReplaceTokens: oldSelector with: newSelector) ] displayingProgress: ('Replacing {1} with {2}' format: {oldSelector. newSelector})
Best, Christoph ________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Taeumel, Marcel Gesendet: Donnerstag, 20. August 2020 14:55:14 An: squeak-dev Betreff: Re: [squeak-dev] The Inbox: 60Deprecated-ct.80.mcz
Thank you for this explanation. Would have made a great commit message ;-)
Also thanks for the highlighted example. Never thought of it that way. Makes sense.
Best, Marcel
Am 20.08.2020 14:52:33 schrieb Thiede, Christoph christoph.thiede@student.hpi.uni-potsdam.de:
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@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@source.squeak.org commits@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]]!
Hi Christoph,
+1 from me to deprecate it. Even if the final decision will be to not deprecate/remove those methods, using #withIndex*: instead of #*WithIndex: in Trunk won't hurt. So, feel free to push those changes, as those should be in the Trunk IMO.
Levente
On Thu, 20 Aug 2020, Thiede, Christoph wrote:
I have stopped to commit the patches to all affected packages, which was a terrible idea as I recognize now. In case we can agree on deprecating #doWithIndex:, I am attaching the corresponding changeset.
FWIW, here is the snippet I used to rename all senders of the deprecated selectors:
oldSelector := #collectWithIndex:. newSelector := #withIndexCollect:.
methods := self systemNavigation allCallsOn: oldSelector. methods do: [:method | method actualClass compile: (method sourceCode copyReplaceTokens: oldSelector with: newSelector) ] displayingProgress: ('Replacing {1} with {2}' format: {oldSelector. newSelector}) [FORM]
Best, Christoph
Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Taeumel, Marcel Gesendet: Donnerstag, 20. August 2020 14:55:14 An: squeak-dev Betreff: Re: [squeak-dev] The Inbox: 60Deprecated-ct.80.mcz Thank you for this explanation. Would have made a great commit message ;-) Also thanks for the highlighted example. Never thought of it that way. Makes sense.
Best, Marcel
Am 20.08.2020 14:52:33 schrieb Thiede, Christoph <christoph.thiede@student.hpi.uni-potsdam.de>: 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@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@source.squeak.org <commits@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]]!
On Thu, Aug 20, 2020 at 7:07 AM Levente Uzonyi leves@caesar.elte.hu wrote:
Hi Christoph,
+1 from me to deprecate it. Even if the final decision will be to not deprecate/remove those methods, using #withIndex*: instead of #*WithIndex: in Trunk won't hurt. So, feel free to push those changes, as those should be in the Trunk IMO.
+1
Levente
On Thu, 20 Aug 2020, Thiede, Christoph wrote:
I have stopped to commit the patches to all affected packages, which was
a terrible idea as I recognize now. In case we can agree on deprecating #doWithIndex:, I am attaching the corresponding changeset.
FWIW, here is the snippet I used to rename all senders of the deprecated
selectors:
oldSelector := #collectWithIndex:. newSelector := #withIndexCollect:.
methods := self systemNavigation allCallsOn: oldSelector. methods do: [:method | method actualClass compile: (method sourceCode copyReplaceTokens: oldSelector with: newSelector) ] displayingProgress: ('Replacing {1} with {2}' format:
{oldSelector. newSelector})
[FORM]
Best, Christoph
Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im
Auftrag von Taeumel, Marcel
Gesendet: Donnerstag, 20. August 2020 14:55:14 An: squeak-dev Betreff: Re: [squeak-dev] The Inbox: 60Deprecated-ct.80.mcz Thank you for this explanation. Would have made a great commit message
;-)
Also thanks for the highlighted example. Never thought of it that way.
Makes sense.
Best, Marcel
Am 20.08.2020 14:52:33 schrieb Thiede, Christoph <
christoph.thiede@student.hpi.uni-potsdam.de>:
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@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@source.squeak.org <
commits@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]]!
Hi all,
any other opinions on this question? If not, shall I proceed to upload the changeset as separate inbox versions or can someone with Trunk permissions do this with one click? :-)
Best,
Christoph
http://www.hpi.de/ ________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Eliot Miranda eliot.miranda@gmail.com Gesendet: Freitag, 21. August 2020 21:29:10 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] The Inbox: 60Deprecated-ct.80.mcz
On Thu, Aug 20, 2020 at 7:07 AM Levente Uzonyi <leves@caesar.elte.humailto:leves@caesar.elte.hu> wrote: Hi Christoph,
+1 from me to deprecate it. Even if the final decision will be to not deprecate/remove those methods, using #withIndex*: instead of #*WithIndex: in Trunk won't hurt. So, feel free to push those changes, as those should be in the Trunk IMO.
+1
Levente
On Thu, 20 Aug 2020, Thiede, Christoph wrote:
I have stopped to commit the patches to all affected packages, which was a terrible idea as I recognize now. In case we can agree on deprecating #doWithIndex:, I am attaching the corresponding changeset.
FWIW, here is the snippet I used to rename all senders of the deprecated selectors:
oldSelector := #collectWithIndex:. newSelector := #withIndexCollect:.
methods := self systemNavigation allCallsOn: oldSelector. methods do: [:method | method actualClass compile: (method sourceCode copyReplaceTokens: oldSelector with: newSelector) ] displayingProgress: ('Replacing {1} with {2}' format: {oldSelector. newSelector}) [FORM]
Best, Christoph
Von: Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.orgmailto:squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel Gesendet: Donnerstag, 20. August 2020 14:55:14 An: squeak-dev Betreff: Re: [squeak-dev] The Inbox: 60Deprecated-ct.80.mcz Thank you for this explanation. Would have made a great commit message ;-) Also thanks for the highlighted example. Never thought of it that way. Makes sense.
Best, Marcel
Am 20.08.2020 14:52:33 schrieb Thiede, Christoph <christoph.thiede@student.hpi.uni-potsdam.de<mailto:christoph.thiede@student.hpi.uni-potsdam.de>>: 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@lists.squeakfoundation.orgmailto:squeak-dev-bounces@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@source.squeak.org<mailto:commits@source.squeak.org> <commits@source.squeak.org<mailto:commits@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]]!
-- _,,,^..^,,,_ best, Eliot
squeak-dev@lists.squeakfoundation.org