[squeak-dev] The Trunk: System-ct.1133.mcz
Levente Uzonyi
leves at caesar.elte.hu
Wed Nov 4 10:33:04 UTC 2020
It would be nice if #in: was not used when a temporary variable does the
job.
And all those returns from inside the blocks can be avoided by returning
what the block would return (see example below if not clear).
Levente
On Wed, 4 Nov 2020, commits at source.squeak.org wrote:
> Marcel Taeumel uploaded a new version of System to project The Trunk:
> http://source.squeak.org/trunk/System-ct.1133.mcz
>
> ==================== Summary ====================
>
> Name: System-ct.1133
> Author: ct
> Time: 3 February 2020, 11:55:06.856675 pm
> UUID: bd5c789a-39d3-574b-aa2a-0f900b3a8009
> Ancestors: System-cmm.1131
>
> Fix execution-around pattern to forward return value in some during methods
>
> So that
> Utilities useAuthorName: 'Squeak' during: [Utilities authorName]
> yields
> 'Squeak'
> but not
> Utilities.
>
> =============== Diff against System-cmm.1131 ===============
>
> Item was changed:
> ----- Method: Preferences class>>setFlag:toValue:during: (in category 'get/set - flags') -----
> setFlag: prefSymbol toValue: aBoolean during: aBlock
> "Set the flag to the given value for the duration of aBlock"
>
> (self valueOfFlag: prefSymbol) in: [:previous |
> self setFlag: prefSymbol toValue: aBoolean.
> + ^ aBlock ensure: [self setFlag: prefSymbol toValue: previous]].!
> - aBlock ensure: [self setFlag: prefSymbol toValue: previous]].!
>
> Item was changed:
> ----- Method: Preferences class>>setPreference:toValue:during: (in category 'get/set') -----
> setPreference: prefSymbol toValue: anObject during: aBlock
>
> (self valueOfPreference: prefSymbol) in: [:previous |
> self setPreference: prefSymbol toValue: anObject.
> + ^ aBlock ensure: [self setPreference: prefSymbol toValue: previous]]!
> - aBlock ensure: [self setPreference: prefSymbol toValue: previous]].!
>
> Item was changed:
> ----- Method: Utilities class>>useAuthorInitials:during: (in category 'identification') -----
> useAuthorInitials: temporaryAuthorInitials during: aBlock
>
> | originalAuthorInitials |
> originalAuthorInitials := AuthorInitials.
> + [ AuthorInitials := temporaryAuthorInitials.
> + ^ aBlock value ]
^[ AuthorName := temporaryAuthorName.
aBlock value ]
> - [
> - AuthorInitials := temporaryAuthorInitials.
> - aBlock value ]
> ensure: [ AuthorInitials := originalAuthorInitials ]
> !
>
> Item was changed:
> ----- Method: Utilities class>>useAuthorName:during: (in category 'identification') -----
> useAuthorName: temporaryAuthorName during: aBlock
>
> | originalAuthorName |
> originalAuthorName := AuthorName.
> + [ AuthorName := temporaryAuthorName.
> + ^ aBlock value ]
> - [
> - AuthorName := temporaryAuthorName.
> - aBlock value ]
> ensure: [ AuthorName := originalAuthorName ]
> !
More information about the Squeak-dev
mailing list
|