From e497f5a69d93ed88eec6c56eee2ee0ea053ec8cb Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 13:17:08 -0300 Subject: [PATCH 01/14] Move Behavior and Symbol extensions to its own packages --- source/BaselineOfBuoy/BaselineOfBuoy.class.st | 6 ++++-- .../Behavior.extension.st | 2 +- .../Symbol.extension.st | 2 +- source/Buoy-Metaprogramming-Pharo-Extensions/package.st | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) rename source/{Buoy-Metaprogramming => Buoy-Metaprogramming-Extensions}/Behavior.extension.st (79%) rename source/{Buoy-Metaprogramming => Buoy-Metaprogramming-Pharo-Extensions}/Symbol.extension.st (56%) create mode 100644 source/Buoy-Metaprogramming-Pharo-Extensions/package.st diff --git a/source/BaselineOfBuoy/BaselineOfBuoy.class.st b/source/BaselineOfBuoy/BaselineOfBuoy.class.st index 3bcdffb..2a39743 100644 --- a/source/BaselineOfBuoy/BaselineOfBuoy.class.st +++ b/source/BaselineOfBuoy/BaselineOfBuoy.class.st @@ -129,10 +129,12 @@ BaselineOfBuoy >> baselineMetaprogramming: spec [ group: 'Deployment' with: 'Buoy-Metaprogramming'; package: 'Buoy-Metaprogramming-Extensions' with: [ spec requires: 'Buoy-Assertions' ]; - group: 'Deployment' with: 'Buoy-Metaprogramming-Extensions'; + package: 'Buoy-Metaprogramming-Pharo-Extensions'; + group: 'Deployment' with: 'Buoy-Metaprogramming-Pharo-Extensions'; package: 'Buoy-Metaprogramming-Tests' with: [ spec requires: - #( 'Buoy-Metaprogramming' 'Buoy-Metaprogramming-Extensions' ) ]; + #( 'Buoy-Metaprogramming' 'Buoy-Metaprogramming-Extensions' + 'Buoy-Metaprogramming-Pharo-Extensions' ) ]; group: 'Tests' with: 'Buoy-Metaprogramming-Tests' ] diff --git a/source/Buoy-Metaprogramming/Behavior.extension.st b/source/Buoy-Metaprogramming-Extensions/Behavior.extension.st similarity index 79% rename from source/Buoy-Metaprogramming/Behavior.extension.st rename to source/Buoy-Metaprogramming-Extensions/Behavior.extension.st index d008393..469baee 100644 --- a/source/Buoy-Metaprogramming/Behavior.extension.st +++ b/source/Buoy-Metaprogramming-Extensions/Behavior.extension.st @@ -1,6 +1,6 @@ Extension { #name : #Behavior } -{ #category : #'*Buoy-Metaprogramming' } +{ #category : #'*Buoy-Metaprogramming-Extensions' } Behavior >> allLeafSubclasses [ | leafs | diff --git a/source/Buoy-Metaprogramming/Symbol.extension.st b/source/Buoy-Metaprogramming-Pharo-Extensions/Symbol.extension.st similarity index 56% rename from source/Buoy-Metaprogramming/Symbol.extension.st rename to source/Buoy-Metaprogramming-Pharo-Extensions/Symbol.extension.st index edbb764..1fbba8b 100644 --- a/source/Buoy-Metaprogramming/Symbol.extension.st +++ b/source/Buoy-Metaprogramming-Pharo-Extensions/Symbol.extension.st @@ -1,6 +1,6 @@ Extension { #name : #Symbol } -{ #category : #'*Buoy-Metaprogramming' } +{ #category : #'*Buoy-Metaprogramming-Pharo-Extensions' } Symbol >> argumentCount [ ^self numArgs diff --git a/source/Buoy-Metaprogramming-Pharo-Extensions/package.st b/source/Buoy-Metaprogramming-Pharo-Extensions/package.st new file mode 100644 index 0000000..6d81509 --- /dev/null +++ b/source/Buoy-Metaprogramming-Pharo-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Metaprogramming-Pharo-Extensions' } From f4f933e607c911e9df319c2c7ea24ac23b4a9f70 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 13:23:32 -0300 Subject: [PATCH 02/14] Add Metaprogramming and Dynamic-Binding packages to GS64 --- rowan/components/Deployment.ston | 2 ++ rowan/components/Tests.ston | 2 ++ 2 files changed, 4 insertions(+) diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston index 33593ff..569ee3c 100644 --- a/rowan/components/Deployment.ston +++ b/rowan/components/Deployment.ston @@ -8,6 +8,8 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Collections-GS64-Extensions', 'Buoy-Conditions-Extensions', 'Buoy-Conditions', + 'Buoy-Dynamic-Binding', + 'Buoy-Metaprogramming', 'Buoy-Metaprogramming-Extensions', 'Buoy-Metaprogramming-GS64-Extensions' ], diff --git a/rowan/components/Tests.ston b/rowan/components/Tests.ston index 59bc88e..f67123f 100644 --- a/rowan/components/Tests.ston +++ b/rowan/components/Tests.ston @@ -9,6 +9,8 @@ RwSimpleProjectLoadComponentV2 { #packageNames : [ 'Buoy-Assertions-Tests', 'Buoy-Conditions-Tests', + 'Buoy-Dynamic-Binding-Tests', + 'Buoy-Metaprogramming-Tests', 'Buoy-SUnit-Tests' ], #comment : '' From 223e2935b613dade0d757ff23c5379143c3ffe9e Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:00:52 -0300 Subject: [PATCH 03/14] Move Object comparison extensions to its own package --- source/BaselineOfBuoy/BaselineOfBuoy.class.st | 9 +++++++-- .../Object.extension.st | 4 ++-- source/Buoy-Comparison-Extensions/package.st | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) rename source/{Buoy-Comparison => Buoy-Comparison-Extensions}/Object.extension.st (67%) create mode 100644 source/Buoy-Comparison-Extensions/package.st diff --git a/source/BaselineOfBuoy/BaselineOfBuoy.class.st b/source/BaselineOfBuoy/BaselineOfBuoy.class.st index 2a39743..4b85f32 100644 --- a/source/BaselineOfBuoy/BaselineOfBuoy.class.st +++ b/source/BaselineOfBuoy/BaselineOfBuoy.class.st @@ -62,10 +62,15 @@ BaselineOfBuoy >> baselineCollections: spec [ BaselineOfBuoy >> baselineComparison: spec [ spec - package: 'Buoy-Comparison' with: [ spec requires: 'Buoy-Assertions' ]; + package: 'Buoy-Comparison' + with: [ spec requires: 'Buoy-Assertions' ]; group: 'Deployment' with: 'Buoy-Comparison'; + package: 'Buoy-Comparison-Extensions' + with: [ spec requires: 'Buoy-Comparison' ]; + group: 'Deployment' with: 'Buoy-Comparison-Extensions'; package: 'Buoy-Comparison-Tests' - with: [ spec requires: #('Buoy-Comparison' 'Dependent-SUnit-Extensions') ]; + with: [ + spec requires: #( 'Buoy-Comparison-Extensions' 'Dependent-SUnit-Extensions' ) ]; group: 'Tests' with: 'Buoy-Comparison-Tests' ] diff --git a/source/Buoy-Comparison/Object.extension.st b/source/Buoy-Comparison-Extensions/Object.extension.st similarity index 67% rename from source/Buoy-Comparison/Object.extension.st rename to source/Buoy-Comparison-Extensions/Object.extension.st index 41d7a5a..b74b09c 100644 --- a/source/Buoy-Comparison/Object.extension.st +++ b/source/Buoy-Comparison-Extensions/Object.extension.st @@ -1,12 +1,12 @@ Extension { #name : #Object } -{ #category : #'*Buoy-Comparison' } +{ #category : #'*Buoy-Comparison-Extensions' } Object >> equalityChecker [ ^ PropertyBasedEqualityChecker on: self ] -{ #category : #'*Buoy-Comparison' } +{ #category : #'*Buoy-Comparison-Extensions' } Object >> equalityHashCombinator [ ^ BitwiseExclusiveDisjunctionHashCombinator new diff --git a/source/Buoy-Comparison-Extensions/package.st b/source/Buoy-Comparison-Extensions/package.st new file mode 100644 index 0000000..2643441 --- /dev/null +++ b/source/Buoy-Comparison-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Comparison-Extensions' } From 0183992fb03df4ff03f9976607638152d99dbb43 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:05:15 -0300 Subject: [PATCH 04/14] Add comparison packages to rowan specs --- rowan/components/Deployment.ston | 7 ++++++- rowan/components/Tests.ston | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston index 569ee3c..c762b9b 100644 --- a/rowan/components/Deployment.ston +++ b/rowan/components/Deployment.ston @@ -6,8 +6,10 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Assertions', 'Buoy-Assertions-Extensions', 'Buoy-Collections-GS64-Extensions', - 'Buoy-Conditions-Extensions', + 'Buoy-Comparison', + 'Buoy-Comparison-Extentions', 'Buoy-Conditions', + 'Buoy-Conditions-Extensions', 'Buoy-Dynamic-Binding', 'Buoy-Metaprogramming', 'Buoy-Metaprogramming-Extensions', @@ -23,6 +25,9 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Collections-GS64-Extensions' : { 'symbolDictName' : 'Globals' }, + 'Buoy-Comparison-Extensions' : { + 'symbolDictName' : 'Globals' + }, 'Buoy-Conditions-Extensions' : { 'symbolDictName' : 'Globals' }, diff --git a/rowan/components/Tests.ston b/rowan/components/Tests.ston index f67123f..fa759b2 100644 --- a/rowan/components/Tests.ston +++ b/rowan/components/Tests.ston @@ -8,6 +8,7 @@ RwSimpleProjectLoadComponentV2 { ], #packageNames : [ 'Buoy-Assertions-Tests', + 'Buoy-Comparison-Tests', 'Buoy-Conditions-Tests', 'Buoy-Dynamic-Binding-Tests', 'Buoy-Metaprogramming-Tests', From a662cbaf02ef628ab1dda213d435fbee074c6de4 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:07:05 -0300 Subject: [PATCH 05/14] Fix package name typo --- rowan/components/Deployment.ston | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston index c762b9b..69462d8 100644 --- a/rowan/components/Deployment.ston +++ b/rowan/components/Deployment.ston @@ -7,7 +7,7 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Assertions-Extensions', 'Buoy-Collections-GS64-Extensions', 'Buoy-Comparison', - 'Buoy-Comparison-Extentions', + 'Buoy-Comparison-Extensions', 'Buoy-Conditions', 'Buoy-Conditions-Extensions', 'Buoy-Dynamic-Binding', From 3911d9dd84e9bcaebee739910c93623311cddd58 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:16:02 -0300 Subject: [PATCH 06/14] Add Collection>>#ifEmpty:ifNotEmpty: to GS64 package Change usage of ifNotEmpty:ifEmpty: in favour of the previous one --- .../Collection.extension.st | 8 +++++++ source/Buoy-Dynamic-Binding/Optional.class.st | 24 ++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st index 78e4823..474e1f9 100644 --- a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st +++ b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st @@ -5,3 +5,11 @@ Collection >> anyOne [ ^ self any ] + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +Collection >> ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock [ + + ^ self isEmpty + ifTrue: emptyBlock + ifFalse: [ notEmptyBlock cull: self ] +] diff --git a/source/Buoy-Dynamic-Binding/Optional.class.st b/source/Buoy-Dynamic-Binding/Optional.class.st index 5f45bb3..353b2c5 100644 --- a/source/Buoy-Dynamic-Binding/Optional.class.st +++ b/source/Buoy-Dynamic-Binding/Optional.class.st @@ -34,29 +34,37 @@ Optional class >> unusedBecauseAll: anExplanationCollection [ { #category : #'instance creation' } Optional class >> whenAllUsedIn: optionals injectInto: aDyadicBlock [ - ^ optionals ifNotEmpty: [ optionals first whenAllUsedIn: optionals allButFirst injectInto: aDyadicBlock ] ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + whenAllUsedIn: optionals allButFirst + injectInto: aDyadicBlock ] ] { #category : #'instance creation' } Optional class >> whenAllUsedIn: optionals return: aMonadycBlock [ - ^ optionals ifNotEmpty: [ optionals first whenAllUsedIn: optionals allButFirst return: aMonadycBlock ] ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + whenAllUsedIn: optionals allButFirst + return: aMonadycBlock ] ] { #category : #'instance creation' } Optional class >> withUsedOnlyIn: optionals injectInto: aDyadicBlock [ - ^ optionals - ifNotEmpty: [ optionals first withUsedOnlyIn: optionals allButFirst injectInto: aDyadicBlock ] - ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + withUsedOnlyIn: optionals allButFirst + injectInto: aDyadicBlock ] ] { #category : #'instance creation' } Optional class >> withUsedOnlyIn: optionals return: aMonadycBlock [ - ^ optionals - ifNotEmpty: [ optionals first withUsedOnlyIn: optionals allButFirst return: aMonadycBlock ] - ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + withUsedOnlyIn: optionals allButFirst + return: aMonadycBlock ] ] { #category : #comparing } From 229d19c77e50bbcbedd03e3444483f04364d4eda Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:20:45 -0300 Subject: [PATCH 07/14] Add Number>>#isZero --- source/Buoy-Math-GS64-Extensions/Number.extension.st | 7 +++++++ source/Buoy-Math-GS64-Extensions/package.st | 1 + 2 files changed, 8 insertions(+) create mode 100644 source/Buoy-Math-GS64-Extensions/Number.extension.st create mode 100644 source/Buoy-Math-GS64-Extensions/package.st diff --git a/source/Buoy-Math-GS64-Extensions/Number.extension.st b/source/Buoy-Math-GS64-Extensions/Number.extension.st new file mode 100644 index 0000000..da64aef --- /dev/null +++ b/source/Buoy-Math-GS64-Extensions/Number.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #Number } + +{ #category : #'*Buoy-Math-GS64-Extensions' } +Number >> isZero [ + + ^ self = 0 +] diff --git a/source/Buoy-Math-GS64-Extensions/package.st b/source/Buoy-Math-GS64-Extensions/package.st new file mode 100644 index 0000000..3bb7517 --- /dev/null +++ b/source/Buoy-Math-GS64-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Math-GS64-Extensions' } From c2fefdb42fe69303b583467d3bb579ee8e3dbfd1 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:21:53 -0300 Subject: [PATCH 08/14] Add extension package to rowan specs --- rowan/components/Deployment.ston | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston index 69462d8..ea38862 100644 --- a/rowan/components/Deployment.ston +++ b/rowan/components/Deployment.ston @@ -11,6 +11,7 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Conditions', 'Buoy-Conditions-Extensions', 'Buoy-Dynamic-Binding', + 'Buoy-Math-GS64-Extensions', 'Buoy-Metaprogramming', 'Buoy-Metaprogramming-Extensions', 'Buoy-Metaprogramming-GS64-Extensions' @@ -31,6 +32,9 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Conditions-Extensions' : { 'symbolDictName' : 'Globals' }, + 'Buoy-Math-GS64-Extensions' : { + 'symbolDictName' : 'Globals' + }, 'Buoy-Metaprogramming-Extensions' : { 'symbolDictName' : 'Globals' }, From 5b91793bf37b2003dd10fadd7834bb1d59c69065 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:25:12 -0300 Subject: [PATCH 09/14] Add Collection>>#select:thenCollect: --- .../Collection.extension.st | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st index 474e1f9..de279e3 100644 --- a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st +++ b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st @@ -13,3 +13,9 @@ Collection >> ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock [ ifTrue: emptyBlock ifFalse: [ notEmptyBlock cull: self ] ] + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +Collection >> select: selectBlock thenCollect: collectBlock [ + + ^ (self select: selectBlock) collect: collectBlock +] From 34b62a13e85fa060a2217b6e74b3bd150346a8dc Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:43:55 -0300 Subject: [PATCH 10/14] Improve allLeafSubclasses to work on GS64. Add extension to AbstractDictionary --- .../AbstractDictionary.extension.st | 13 +++++++++++++ .../AbstractDictionary.class.st | 10 ++++++++++ .../Buoy-GS64-Compatibility/ClassOrganizer.class.st | 10 ++++++++++ .../Class.extension.st | 11 +++++++++++ .../Behavior.extension.st | 2 +- 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st create mode 100644 source/Buoy-GS64-Compatibility/AbstractDictionary.class.st create mode 100644 source/Buoy-GS64-Compatibility/ClassOrganizer.class.st create mode 100644 source/Buoy-Metaprogramming-GS64-Extensions/Class.extension.st rename source/{Buoy-Metaprogramming-Extensions => Buoy-Metaprogramming-Pharo-Extensions}/Behavior.extension.st (78%) diff --git a/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st b/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st new file mode 100644 index 0000000..a81ab0e --- /dev/null +++ b/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #AbstractDictionary } + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +AbstractDictionary >> at: key ifPresent: aBlock ifAbsentPut: anAbsentBlock [ + + | presentValue | + presentValue := self at: key ifAbsent: [ + | absentValue | + absentValue := anAbsentBlock value. + self at: key put: absentValue. + ^ absentValue ]. + ^ aBlock value: presentValue +] diff --git a/source/Buoy-GS64-Compatibility/AbstractDictionary.class.st b/source/Buoy-GS64-Compatibility/AbstractDictionary.class.st new file mode 100644 index 0000000..2180cb9 --- /dev/null +++ b/source/Buoy-GS64-Compatibility/AbstractDictionary.class.st @@ -0,0 +1,10 @@ +" +AbstractDictionary is an abstract class in GS64, the superclass of all the Dictionary-like abstractions. +This version is just a placeholder so we can easily create extension methods to load in GS64 specific +packages. +" +Class { + #name : #AbstractDictionary, + #superclass : #Collection, + #category : #'Buoy-GS64-Compatibility' +} diff --git a/source/Buoy-GS64-Compatibility/ClassOrganizer.class.st b/source/Buoy-GS64-Compatibility/ClassOrganizer.class.st new file mode 100644 index 0000000..6b4afc5 --- /dev/null +++ b/source/Buoy-GS64-Compatibility/ClassOrganizer.class.st @@ -0,0 +1,10 @@ +" +In GS64, a `ClassOrganizer` can answer queries about classes in the image, provides + tools and reports on information on classes and methods and can perform + cross-referencing and fileout. +" +Class { + #name : #ClassOrganizer, + #superclass : #Object, + #category : #'Buoy-GS64-Compatibility' +} diff --git a/source/Buoy-Metaprogramming-GS64-Extensions/Class.extension.st b/source/Buoy-Metaprogramming-GS64-Extensions/Class.extension.st new file mode 100644 index 0000000..15d1df2 --- /dev/null +++ b/source/Buoy-Metaprogramming-GS64-Extensions/Class.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #Class } + +{ #category : #'*Buoy-Metaprogramming-GS64-Extensions' } +Class >> allLeafSubclasses [ + + | leafs | + leafs := OrderedCollection new. + (ClassOrganizer new allSubclassesOf: self) do: [ :class | + class subclasses ifEmpty: [ leafs add: class ] ]. + ^ leafs +] diff --git a/source/Buoy-Metaprogramming-Extensions/Behavior.extension.st b/source/Buoy-Metaprogramming-Pharo-Extensions/Behavior.extension.st similarity index 78% rename from source/Buoy-Metaprogramming-Extensions/Behavior.extension.st rename to source/Buoy-Metaprogramming-Pharo-Extensions/Behavior.extension.st index 469baee..8c88cc1 100644 --- a/source/Buoy-Metaprogramming-Extensions/Behavior.extension.st +++ b/source/Buoy-Metaprogramming-Pharo-Extensions/Behavior.extension.st @@ -1,6 +1,6 @@ Extension { #name : #Behavior } -{ #category : #'*Buoy-Metaprogramming-Extensions' } +{ #category : #'*Buoy-Metaprogramming-Pharo-Extensions' } Behavior >> allLeafSubclasses [ | leafs | From 8f730b8b508445fb8eab8255a071d03b2b4eaba5 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:50:10 -0300 Subject: [PATCH 11/14] Add missing extensions --- .../AbstractDictionary.extension.st | 2 +- .../CharacterCollection.extension.st | 6 ++++++ .../Collection.extension.st | 6 ++++++ .../SequenceableCollection.extension.st | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 source/Buoy-Collections-GS64-Extensions/SequenceableCollection.extension.st diff --git a/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st b/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st index a81ab0e..098a20a 100644 --- a/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st +++ b/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st @@ -9,5 +9,5 @@ AbstractDictionary >> at: key ifPresent: aBlock ifAbsentPut: anAbsentBlock [ absentValue := anAbsentBlock value. self at: key put: absentValue. ^ absentValue ]. - ^ aBlock value: presentValue + ^ aBlock cull: presentValue ] diff --git a/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st b/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st index 038f2f6..15b8772 100644 --- a/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st +++ b/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st @@ -6,6 +6,12 @@ CharacterCollection >> expandMacros [ ^ self expandMacrosWithArguments: #( ) ] +{ #category : #'*Buoy-Collections-GS64-Extensions' } +CharacterCollection >> expandMacrosWith: anObject [ + + ^ self expandMacrosWithArguments: { anObject } +] + { #category : #'*Buoy-Collections-GS64-Extensions' } CharacterCollection >> expandMacrosWith: anObject with: anotherObject [ diff --git a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st index de279e3..9c16631 100644 --- a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st +++ b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st @@ -14,6 +14,12 @@ Collection >> ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock [ ifFalse: [ notEmptyBlock cull: self ] ] +{ #category : #'*Buoy-Collections-GS64-Extensions' } +Collection >> isSequenceable [ + + ^ false +] + { #category : #'*Buoy-Collections-GS64-Extensions' } Collection >> select: selectBlock thenCollect: collectBlock [ diff --git a/source/Buoy-Collections-GS64-Extensions/SequenceableCollection.extension.st b/source/Buoy-Collections-GS64-Extensions/SequenceableCollection.extension.st new file mode 100644 index 0000000..99275fb --- /dev/null +++ b/source/Buoy-Collections-GS64-Extensions/SequenceableCollection.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #SequenceableCollection } + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +SequenceableCollection >> isSequenceable [ + + ^ true +] From 191336ad77498c2f84cece3f6609e2554d944ccb Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:54:57 -0300 Subject: [PATCH 12/14] Move collection extensions to its own package --- source/BaselineOfBuoy/BaselineOfBuoy.class.st | 14 +++++++++---- .../SequenceableCollection.extension.st | 20 +++++++++++++++++++ source/Buoy-Collections-Extensions/package.st | 1 + .../SequenceableCollection.extension.st | 19 ------------------ 4 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 source/Buoy-Collections-Extensions/SequenceableCollection.extension.st create mode 100644 source/Buoy-Collections-Extensions/package.st diff --git a/source/BaselineOfBuoy/BaselineOfBuoy.class.st b/source/BaselineOfBuoy/BaselineOfBuoy.class.st index 4b85f32..ac69e60 100644 --- a/source/BaselineOfBuoy/BaselineOfBuoy.class.st +++ b/source/BaselineOfBuoy/BaselineOfBuoy.class.st @@ -50,11 +50,17 @@ BaselineOfBuoy >> baselineAssertions: spec [ BaselineOfBuoy >> baselineCollections: spec [ spec - package: 'Buoy-Collections' - with: [ spec requires: #( 'Buoy-Assertions' 'Buoy-Dynamic-Binding' 'Buoy-Comparison' ) ]; + package: 'Buoy-Collections' with: [ + spec requires: + #( 'Buoy-Assertions' 'Buoy-Dynamic-Binding' + 'Buoy-Comparison' ) ]; group: 'Deployment' with: 'Buoy-Collections'; - package: 'Buoy-Collections-Tests' - with: [ spec requires: #( 'Buoy-Collections' 'Dependent-SUnit-Extensions' ) ]; + package: 'Buoy-Collections-Extensions' + with: [ spec requires: 'Buoy-Collections' ]; + group: 'Deployment' with: 'Buoy-Collections-Extensions'; + package: 'Buoy-Collections-Tests' with: [ + spec requires: #( 'Buoy-Collections' 'Buoy-Collections-Extensions' + 'Dependent-SUnit-Extensions' ) ]; group: 'Tests' with: 'Buoy-Collections-Tests' ] diff --git a/source/Buoy-Collections-Extensions/SequenceableCollection.extension.st b/source/Buoy-Collections-Extensions/SequenceableCollection.extension.st new file mode 100644 index 0000000..e593e90 --- /dev/null +++ b/source/Buoy-Collections-Extensions/SequenceableCollection.extension.st @@ -0,0 +1,20 @@ +Extension { #name : #SequenceableCollection } + +{ #category : #'*Buoy-Collections-Extensions' } +SequenceableCollection >> equalityChecker [ + + ^ SequenceableCollectionEqualityChecker new +] + +{ #category : #'*Buoy-Collections-Extensions' } +SequenceableCollection >> withoutFirst [ + + ^self withoutFirst: 1 +] + +{ #category : #'*Buoy-Collections-Extensions' } +SequenceableCollection >> withoutFirst: n [ + + (self size <= n) ifTrue: [^self species new]. + ^self copyFrom: n + 1 to: self size +] diff --git a/source/Buoy-Collections-Extensions/package.st b/source/Buoy-Collections-Extensions/package.st new file mode 100644 index 0000000..b2fcb35 --- /dev/null +++ b/source/Buoy-Collections-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Collections-Extensions' } diff --git a/source/Buoy-Collections/SequenceableCollection.extension.st b/source/Buoy-Collections/SequenceableCollection.extension.st index a04e5b4..c463f2d 100644 --- a/source/Buoy-Collections/SequenceableCollection.extension.st +++ b/source/Buoy-Collections/SequenceableCollection.extension.st @@ -23,22 +23,3 @@ SequenceableCollection >> copyNoMoreThanLast: n [ ^ self copyLast: ( n min: self size ) ] - -{ #category : #'*Buoy-Collections' } -SequenceableCollection >> equalityChecker [ - - ^ SequenceableCollectionEqualityChecker new -] - -{ #category : #'*Buoy-Collections' } -SequenceableCollection >> withoutFirst [ - - ^self withoutFirst: 1 -] - -{ #category : #'*Buoy-Collections' } -SequenceableCollection >> withoutFirst: n [ - - (self size <= n) ifTrue: [^self species new]. - ^self copyFrom: n + 1 to: self size -] From 47a89eaed4c72ed3a42f3235913d6c64d9d94918 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 14:56:05 -0300 Subject: [PATCH 13/14] Add new package to rowan spec --- rowan/components/Deployment.ston | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston index ea38862..729b3b9 100644 --- a/rowan/components/Deployment.ston +++ b/rowan/components/Deployment.ston @@ -5,6 +5,7 @@ RwSimpleProjectLoadComponentV2 { #packageNames : [ 'Buoy-Assertions', 'Buoy-Assertions-Extensions', + 'Buoy-Collections-Extensions', 'Buoy-Collections-GS64-Extensions', 'Buoy-Comparison', 'Buoy-Comparison-Extensions', @@ -23,6 +24,9 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Assertions-Extensions' : { 'symbolDictName' : 'Globals' }, + 'Buoy-Collections-Extensions' : { + 'symbolDictName' : 'Globals' + }, 'Buoy-Collections-GS64-Extensions' : { 'symbolDictName' : 'Globals' }, From 8241f5f65031ead3f7db1a37ed120483b472c5e5 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 7 Aug 2023 15:02:22 -0300 Subject: [PATCH 14/14] Improve test portability --- source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st b/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st index fc62c29..4672190 100644 --- a/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st +++ b/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st @@ -66,7 +66,7 @@ NamespaceTest >> testBindTo [ namespace bind: #Zero to: 0. self - assertCollection: namespace names equals: #(#Zero); + assertCollection: namespace names hasSameElements: #(#Zero); assert: namespace >> #Zero equals: 0 ]