Christoph Thiede uploaded a new version of Tools to project The Trunk: http://source.squeak.org/trunk/Tools-ct.1246.mcz
==================== Summary ====================
Name: Tools-ct.1246 Author: ct Time: 26 February 2024, 4:00:04.757882 pm UUID: fbc966c6-6300-9846-be17-593f1a2530d6 Ancestors: Tools-ct.1245
Fixes slip from Tools-ct.1245.
=============== Diff against Tools-ct.1245 ===============
Item was changed: ----- Method: Debugger>>contents:notifying: (in category 'accessing') ----- contents: aText notifying: aController "Accept new method source of the selected context."
| selector classOfMethod category ctxt newMethod | contextStackIndex = 0 ifTrue: [^ false]. "First, handle some edge cases" selector := self selectedClass newParser parseSelector: aText. "selector isDoIt ifTrue: [ currentCompiledMethod := self compileDoIt: aText]." self flag: #todo. "ct: Recompile doIt method *without* creating method litters!! See Compiler>>#evaluateCue:ifFail:." selector = self selectedMessageName ifFalse: [ "Different message compiled, delegating to super" ^ super contents: aText notifying: aController]. self selectedContext isExecutingBlock ifTrue: [ "If we are in a block context, we need to rewind the stack before ." | home | home := self selectedContext activeHome. home ifNil: [ (self confirm: 'Method for block not found on stack, can''t edit and continue. Update method anyway?' translated) ifFalse: [ ^ false]. ^ (super contents: aText notifying: aController) ifTrue: [ contents := nil. self contentsChanged. self inform: 'Method was updated, but cannot revert the stack to it.' translated]; yourself]. (self confirm: 'I will have to revert to the method from\which this block originated. Is that OK?' translated withCRs) ifFalse: [ ^ false]. self resetContext: home changeContents: false. "N.B. Only reset the contents if the compilation succeeds. If contents would be reset when compilation fails, both compiler error message and modifications were lost." ^ (self contents: aText notifying: aController) ifTrue: [self contentsChanged]; yourself]. classOfMethod := self selectedClass. category := self selectedMessageCategoryName. "Do the actual compilation" selector := classOfMethod compile: aText classified: category notifying: aController. selector ifNil: [^ false]. "compilation cancelled" "Update views" contents := aText. newMethod := classOfMethod compiledMethodAt: selector. newMethod isQuick ifTrue: [ self cutBackExecutionToSenderContext]. ctxt := interruptedProcess popTo: self selectedContext. ctxt == self selectedContext ifFalse: [self inform: 'Method saved, but current context unchanged\because of unwind error. Click OK to see error' translated withCRs] ifTrue: [ newMethod isQuick ifFalse: [ + interruptedProcess restartTopWith: newMethod. - ctxt := interruptedProcess restartTopWith: newMethod. ctxt := interruptedProcess stepToSendOrReturn]. contextVariablesInspector object: nil]. self resetContext: ctxt. Project current addDeferredUIMessage: [ self changed: #contentsSelection]. ^ true!
This is great. One suggestion, look up Rectangular Block in Beck’s Smalltalk Best Practice Patterns.
_,,,^..^,,,_ (phone)
On Feb 26, 2024, at 7:00 AM, commits@source.squeak.org wrote:
Christoph Thiede uploaded a new version of Tools to project The Trunk: http://source.squeak.org/trunk/Tools-ct.1246.mcz
==================== Summary ====================
Name: Tools-ct.1246 Author: ct Time: 26 February 2024, 4:00:04.757882 pm UUID: fbc966c6-6300-9846-be17-593f1a2530d6 Ancestors: Tools-ct.1245
Fixes slip from Tools-ct.1245.
=============== Diff against Tools-ct.1245 ===============
Item was changed: ----- Method: Debugger>>contents:notifying: (in category 'accessing') ----- contents: aText notifying: aController "Accept new method source of the selected context."
| selector classOfMethod category ctxt newMethod | contextStackIndex = 0 ifTrue: [^ false]. "First, handle some edge cases" selector := self selectedClass newParser parseSelector: aText. "selector isDoIt ifTrue: [ currentCompiledMethod := self compileDoIt: aText]." self flag: #todo. "ct: Recompile doIt method *without* creating method litters!! See Compiler>>#evaluateCue:ifFail:." selector = self selectedMessageName ifFalse: [ "Different message compiled, delegating to super" ^ super contents: aText notifying: aController]. self selectedContext isExecutingBlock ifTrue: [ "If we are in a block context, we need to rewind the stack before ." | home | home := self selectedContext activeHome. home ifNil: [ (self confirm: 'Method for block not found on stack, can''t edit and continue. Update method anyway?' translated) ifFalse: [ ^ false]. ^ (super contents: aText notifying: aController) ifTrue: [ contents := nil. self contentsChanged. self inform: 'Method was updated, but cannot revert the stack to it.' translated]; yourself]. (self confirm: 'I will have to revert to the method from\which this block originated. Is that OK?' translated withCRs) ifFalse: [ ^ false]. self resetContext: home changeContents: false. "N.B. Only reset the contents if the compilation succeeds. If contents would be reset when compilation fails, both compiler error message and modifications were lost." ^ (self contents: aText notifying: aController) ifTrue: [self contentsChanged]; yourself]. classOfMethod := self selectedClass. category := self selectedMessageCategoryName. "Do the actual compilation" selector := classOfMethod compile: aText classified: category notifying: aController. selector ifNil: [^ false]. "compilation cancelled" "Update views" contents := aText. newMethod := classOfMethod compiledMethodAt: selector. newMethod isQuick ifTrue: [ self cutBackExecutionToSenderContext]. ctxt := interruptedProcess popTo: self selectedContext. ctxt == self selectedContext ifFalse: [self inform: 'Method saved, but current context unchanged\because of unwind error. Click OK to see error' translated withCRs] ifTrue: [ newMethod isQuick ifFalse: [
interruptedProcess restartTopWith: newMethod.
ctxt := interruptedProcess restartTopWith: newMethod. ctxt := interruptedProcess stepToSendOrReturn]. contextVariablesInspector object: nil].
self resetContext: ctxt.
Project current addDeferredUIMessage: [ self changed: #contentsSelection]. ^ true!
On Feb 26, 2024, at 4:12 PM, Eliot Miranda eliot.miranda@gmail.com wrote:
This is great. One suggestion, look up Rectangular Block in Beck’s Smalltalk Best Practice Patterns.
Notice how you implicitly use this pattern for parentheses, but not for blocks, yet parentheses are purely syntactic, but blocks are code literals.
_,,,^..^,,,_ (phone)
On Feb 26, 2024, at 7:00 AM, commits@source.squeak.org wrote:
Christoph Thiede uploaded a new version of Tools to project The Trunk: http://source.squeak.org/trunk/Tools-ct.1246.mcz
==================== Summary ====================
Name: Tools-ct.1246 Author: ct Time: 26 February 2024, 4:00:04.757882 pm UUID: fbc966c6-6300-9846-be17-593f1a2530d6 Ancestors: Tools-ct.1245
Fixes slip from Tools-ct.1245.
=============== Diff against Tools-ct.1245 ===============
Item was changed: ----- Method: Debugger>>contents:notifying: (in category 'accessing') ----- contents: aText notifying: aController "Accept new method source of the selected context."
| selector classOfMethod category ctxt newMethod | contextStackIndex = 0 ifTrue: [^ false]. "First, handle some edge cases" selector := self selectedClass newParser parseSelector: aText. "selector isDoIt ifTrue: [ currentCompiledMethod := self compileDoIt: aText]." self flag: #todo. "ct: Recompile doIt method *without* creating method litters!! See Compiler>>#evaluateCue:ifFail:." selector = self selectedMessageName ifFalse: [ "Different message compiled, delegating to super" ^ super contents: aText notifying: aController]. self selectedContext isExecutingBlock ifTrue: [ "If we are in a block context, we need to rewind the stack before ." | home | home := self selectedContext activeHome. home ifNil: [ (self confirm: 'Method for block not found on stack, can''t edit and continue. Update method anyway?' translated) ifFalse: [ ^ false]. ^ (super contents: aText notifying: aController) ifTrue: [ contents := nil. self contentsChanged. self inform: 'Method was updated, but cannot revert the stack to it.' translated]; yourself]. (self confirm: 'I will have to revert to the method from\which this block originated. Is that OK?' translated withCRs) ifFalse: [ ^ false]. self resetContext: home changeContents: false. "N.B. Only reset the contents if the compilation succeeds. If contents would be reset when compilation fails, both compiler error message and modifications were lost." ^ (self contents: aText notifying: aController) ifTrue: [self contentsChanged]; yourself]. classOfMethod := self selectedClass. category := self selectedMessageCategoryName. "Do the actual compilation" selector := classOfMethod compile: aText classified: category notifying: aController. selector ifNil: [^ false]. "compilation cancelled" "Update views" contents := aText. newMethod := classOfMethod compiledMethodAt: selector. newMethod isQuick ifTrue: [ self cutBackExecutionToSenderContext]. ctxt := interruptedProcess popTo: self selectedContext. ctxt == self selectedContext ifFalse: [self inform: 'Method saved, but current context unchanged\because of unwind error. Click OK to see error' translated withCRs] ifTrue: [ newMethod isQuick ifFalse: [
interruptedProcess restartTopWith: newMethod.
ctxt := interruptedProcess restartTopWith: newMethod. ctxt := interruptedProcess stepToSendOrReturn]. contextVariablesInspector object: nil].
self resetContext: ctxt.
Project current addDeferredUIMessage: [ self changed: #contentsSelection]. ^ true!
I know rectangular blocks and currently use them in all my own codebases. But as others have discussed earlier, I will not disrespect existing code styles in existing trunk packages or clutter the diffs by constantly reformatting methods. But thanks for the reminder. Will remember it when uploading the next simulator fixes. :-)
Best, Christoph ________________________________ Von: Eliot Miranda eliot.miranda@gmail.com Gesendet: Dienstag, 27. Februar 2024 01:16 Uhr An: squeak-dev@lists.squeakfoundation.org squeak-dev@lists.squeakfoundation.org Betreff: [squeak-dev] Re: The Trunk: Tools-ct.1246.mcz
On Feb 26, 2024, at 4:12 PM, Eliot Miranda eliot.miranda@gmail.com wrote:
This is great. One suggestion, look up Rectangular Block in Beck’s Smalltalk Best Practice Patterns.
Notice how you implicitly use this pattern for parentheses, but not for blocks, yet parentheses are purely syntactic, but blocks are code literals.
_,,,^..^,,,_ (phone)
On Feb 26, 2024, at 7:00 AM, commits@source.squeak.org wrote:
Christoph Thiede uploaded a new version of Tools to project The Trunk: http://source.squeak.org/trunk/Tools-ct.1246.mcz
==================== Summary ====================
Name: Tools-ct.1246 Author: ct Time: 26 February 2024, 4:00:04.757882 pm UUID: fbc966c6-6300-9846-be17-593f1a2530d6 Ancestors: Tools-ct.1245
Fixes slip from Tools-ct.1245.
=============== Diff against Tools-ct.1245 ===============
Item was changed: ----- Method: Debugger>>contents:notifying: (in category 'accessing') ----- contents: aText notifying: aController "Accept new method source of the selected context."
| selector classOfMethod category ctxt newMethod | contextStackIndex = 0 ifTrue: [^ false]. "First, handle some edge cases" selector := self selectedClass newParser parseSelector: aText. "selector isDoIt ifTrue: [ currentCompiledMethod := self compileDoIt: aText]." self flag: #todo. "ct: Recompile doIt method *without* creating method litters!! See Compiler>>#evaluateCue:ifFail:." selector = self selectedMessageName ifFalse: [ "Different message compiled, delegating to super" ^ super contents: aText notifying: aController]. self selectedContext isExecutingBlock ifTrue: [ "If we are in a block context, we need to rewind the stack before ." | home | home := self selectedContext activeHome. home ifNil: [ (self confirm: 'Method for block not found on stack, can''t edit and continue. Update method anyway?' translated) ifFalse: [ ^ false]. ^ (super contents: aText notifying: aController) ifTrue: [ contents := nil. self contentsChanged. self inform: 'Method was updated, but cannot revert the stack to it.' translated]; yourself]. (self confirm: 'I will have to revert to the method from\which this block originated. Is that OK?' translated withCRs) ifFalse: [ ^ false]. self resetContext: home changeContents: false. "N.B. Only reset the contents if the compilation succeeds. If contents would be reset when compilation fails, both compiler error message and modifications were lost." ^ (self contents: aText notifying: aController) ifTrue: [self contentsChanged]; yourself]. classOfMethod := self selectedClass. category := self selectedMessageCategoryName. "Do the actual compilation" selector := classOfMethod compile: aText classified: category notifying: aController. selector ifNil: [^ false]. "compilation cancelled" "Update views" contents := aText. newMethod := classOfMethod compiledMethodAt: selector. newMethod isQuick ifTrue: [ self cutBackExecutionToSenderContext]. ctxt := interruptedProcess popTo: self selectedContext. ctxt == self selectedContext ifFalse: [self inform: 'Method saved, but current context unchanged\because of unwind error. Click OK to see error' translated withCRs] ifTrue: [ newMethod isQuick ifFalse: [
interruptedProcess restartTopWith: newMethod.
ctxt := interruptedProcess restartTopWith: newMethod. ctxt := interruptedProcess stepToSendOrReturn]. contextVariablesInspector object: nil].
self resetContext: ctxt.
Project current addDeferredUIMessage: [ self changed: #contentsSelection]. ^ true!
squeak-dev@lists.squeakfoundation.org