Eliot Miranda uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-eem.1498.mcz
==================== Summary ====================
Name: Kernel-eem.1498 Author: eem Time: 12 February 2023, 1:30:55.883243 pm UUID: e8b69d4d-8a07-4cf8-8ee7-d764b47f1981 Ancestors: Kernel-tpr.1497
In implementing BlockClosure>>hasMethodReturn, don't assume the byutecode set.
Implement Context>>#home so that it will code with clean blocks.
=============== Diff against Kernel-tpr.1497 ===============
Item was changed: ----- Method: BlockClosure>>hasMethodReturn (in category 'testing') ----- hasMethodReturn "Answer whether the receiver has a method-return ('^') in its code." | scanner endpc | + scanner := InstructionStream new method: self method pc: startpcOrMethod. - scanner := InstructionStream new method: outerContext method pc: startpcOrMethod. endpc := self endPC. + scanner scanFor: + [:byte | + scanner willReturn ifTrue: + [scanner willBlockReturn ifFalse: + [^true]]. + scanner pc >= endpc]. + ^false! - scanner scanFor: [:byte | (byte between: 120 and: 124) or: [scanner pc > endpc]]. - ^scanner pc <= endpc!
Item was changed: ----- Method: Context>>home (in category 'accessing') ----- home + "Answer the outermost context (along the static chain) for the receiver. + This is the outermost lexical scope in which the receiver's method is defined." - "Answer the context in which the receiver was defined."
+ ^closureOrNil + ifNil: [self] "normal method activation" + ifNotNil: "block activation" + [:closure| + closure outerContext + ifNil: [self] "clean block" + ifNotNil: [:outerContext| outerContext home]] "normal block"! - closureOrNil == nil ifTrue: - [^self]. - ^closureOrNil outerContext home!
Hi Eliot, I guess the same fix should apply for #methodReturnContext.
I wanted to ask about this: #home and #methodReturnContext are synonymous; why is that? Some backward compatibility thing or historical reasons?
Similarly I’ve noticed #method and #homeMethod seem synonymous too if I’m not mistaken (in BlockClosure and FullBlockClosure). Is it intentional?
Thanks, Jaromir
From: commits@source.squeak.orgmailto:commits@source.squeak.org Sent: Sunday, February 12, 2023 22:31 To: squeak-dev@lists.squeakfoundation.orgmailto:squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.orgmailto:packages@lists.squeakfoundation.org Subject: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
Eliot Miranda uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-eem.1498.mcz
==================== Summary ====================
Name: Kernel-eem.1498 Author: eem Time: 12 February 2023, 1:30:55.883243 pm UUID: e8b69d4d-8a07-4cf8-8ee7-d764b47f1981 Ancestors: Kernel-tpr.1497
In implementing BlockClosure>>hasMethodReturn, don't assume the byutecode set.
Implement Context>>#home so that it will code with clean blocks.
=============== Diff against Kernel-tpr.1497 ===============
Item was changed: ----- Method: BlockClosure>>hasMethodReturn (in category 'testing') ----- hasMethodReturn "Answer whether the receiver has a method-return ('^') in its code." | scanner endpc | + scanner := InstructionStream new method: self method pc: startpcOrMethod. - scanner := InstructionStream new method: outerContext method pc: startpcOrMethod. endpc := self endPC. + scanner scanFor: + [:byte | + scanner willReturn ifTrue: + [scanner willBlockReturn ifFalse: + [^true]]. + scanner pc >= endpc]. + ^false! - scanner scanFor: [:byte | (byte between: 120 and: 124) or: [scanner pc > endpc]]. - ^scanner pc <= endpc!
Item was changed: ----- Method: Context>>home (in category 'accessing') ----- home + "Answer the outermost context (along the static chain) for the receiver. + This is the outermost lexical scope in which the receiver's method is defined." - "Answer the context in which the receiver was defined."
+ ^closureOrNil + ifNil: [self] "normal method activation" + ifNotNil: "block activation" + [:closure| + closure outerContext + ifNil: [self] "clean block" + ifNotNil: [:outerContext| outerContext home]] "normal block"! - closureOrNil == nil ifTrue: - [^self]. - ^closureOrNil outerContext home!
Actually, FullBlockClosure >> home should be fixed too (returns nil for outerContext = nil):
FullBlockClosure >> home ^ outerContext ifNotNil: [ outerContext home ]
Fix:
FullBlockClosure >> home outerContext ifNotNil: [ ^outerContext home ]
From: Jaromir Matasmailto:mail@jaromir.net Sent: Sunday, February 12, 2023 23:44 To: squeak-dev@lists.squeakfoundation.orgmailto:squeak-dev@lists.squeakfoundation.org; Eliot Mirandamailto:eliot.miranda@gmail.com Subject: Re: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
Hi Eliot, I guess the same fix should apply for #methodReturnContext.
I wanted to ask about this: #home and #methodReturnContext are synonymous; why is that? Some backward compatibility thing or historical reasons?
Similarly I’ve noticed #method and #homeMethod seem synonymous too if I’m not mistaken (in BlockClosure and FullBlockClosure). Is it intentional?
Thanks, Jaromir
From: commits@source.squeak.orgmailto:commits@source.squeak.org Sent: Sunday, February 12, 2023 22:31 To: squeak-dev@lists.squeakfoundation.orgmailto:squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.orgmailto:packages@lists.squeakfoundation.org Subject: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
Eliot Miranda uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-eem.1498.mcz
==================== Summary ====================
Name: Kernel-eem.1498 Author: eem Time: 12 February 2023, 1:30:55.883243 pm UUID: e8b69d4d-8a07-4cf8-8ee7-d764b47f1981 Ancestors: Kernel-tpr.1497
In implementing BlockClosure>>hasMethodReturn, don't assume the byutecode set.
Implement Context>>#home so that it will code with clean blocks.
=============== Diff against Kernel-tpr.1497 ===============
Item was changed: ----- Method: BlockClosure>>hasMethodReturn (in category 'testing') ----- hasMethodReturn "Answer whether the receiver has a method-return ('^') in its code." | scanner endpc | + scanner := InstructionStream new method: self method pc: startpcOrMethod. - scanner := InstructionStream new method: outerContext method pc: startpcOrMethod. endpc := self endPC. + scanner scanFor: + [:byte | + scanner willReturn ifTrue: + [scanner willBlockReturn ifFalse: + [^true]]. + scanner pc >= endpc]. + ^false! - scanner scanFor: [:byte | (byte between: 120 and: 124) or: [scanner pc > endpc]]. - ^scanner pc <= endpc!
Item was changed: ----- Method: Context>>home (in category 'accessing') ----- home + "Answer the outermost context (along the static chain) for the receiver. + This is the outermost lexical scope in which the receiver's method is defined." - "Answer the context in which the receiver was defined."
+ ^closureOrNil + ifNil: [self] "normal method activation" + ifNotNil: "block activation" + [:closure| + closure outerContext + ifNil: [self] "clean block" + ifNotNil: [:outerContext| outerContext home]] "normal block"! - closureOrNil == nil ifTrue: - [^self]. - ^closureOrNil outerContext home!
On Mon, Feb 13, 2023 at 12:10 AM Jaromir Matas mail@jaromir.net wrote:
Actually, FullBlockClosure >> home should be fixed too (returns nil for outerContext = nil):
FullBlockClosure >> home
^ outerContext ifNotNil: [ outerContext home ]
Fix:
FullBlockClosure >> home
outerContext ifNotNil: [ ^outerContext home ]
I'm not sure about this. home answers a context. This fix would have home for a clean block answer the block itself. Is that what we want?
(P.S. feel free to make the other changes you're proposing)
*From: *Jaromir Matas mail@jaromir.net *Sent: *Sunday, February 12, 2023 23:44 *To: *squeak-dev@lists.squeakfoundation.org; Eliot Miranda eliot.miranda@gmail.com *Subject: *Re: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
Hi Eliot,
I guess the same fix should apply for #methodReturnContext.
I wanted to ask about this: #home and #methodReturnContext are synonymous; why is that? Some backward compatibility thing or historical reasons?
Similarly I’ve noticed #method and #homeMethod seem synonymous too if I’m not mistaken (in BlockClosure and FullBlockClosure). Is it intentional?
Thanks,
Jaromir
*From: *commits@source.squeak.org *Sent: *Sunday, February 12, 2023 22:31 *To: *squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org *Subject: *[squeak-dev] The Trunk: Kernel-eem.1498.mcz
Eliot Miranda uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-eem.1498.mcz
==================== Summary ====================
Name: Kernel-eem.1498 Author: eem Time: 12 February 2023, 1:30:55.883243 pm UUID: e8b69d4d-8a07-4cf8-8ee7-d764b47f1981 Ancestors: Kernel-tpr.1497
In implementing BlockClosure>>hasMethodReturn, don't assume the byutecode set.
Implement Context>>#home so that it will code with clean blocks.
=============== Diff against Kernel-tpr.1497 ===============
Item was changed: ----- Method: BlockClosure>>hasMethodReturn (in category 'testing') ----- hasMethodReturn "Answer whether the receiver has a method-return ('^') in its code." | scanner endpc |
scanner := InstructionStream new method: self method pc:
startpcOrMethod.
scanner := InstructionStream new method: outerContext method pc:
startpcOrMethod. endpc := self endPC.
scanner scanFor:
[:byte |
scanner willReturn ifTrue:
[scanner willBlockReturn ifFalse:
[^true]].
scanner pc >= endpc].
^false!
scanner scanFor: [:byte | (byte between: 120 and: 124) or:
[scanner pc > endpc]].
^scanner pc <= endpc!
Item was changed: ----- Method: Context>>home (in category 'accessing') ----- home
"Answer the outermost context (along the static chain) for the
receiver.
This is the outermost lexical scope in which the receiver's
method is defined."
"Answer the context in which the receiver was defined."
^closureOrNil
ifNil: [self] "normal method activation"
ifNotNil: "block activation"
[:closure|
closure outerContext
ifNil: [self] "clean block"
ifNotNil: [:outerContext| outerContext
home]] "normal block"!
closureOrNil == nil ifTrue:
[^self].
^closureOrNil outerContext home!
Hi Eliot,
home answers a context. This fix would have home for a clean block answer the block itself. Is that what we want?
Oops, of course not, apologies, total nonsense.
feel free to make the other changes you're proposing
Thanks, I’ll send methodReturnContext "Answer the context from which an ^-return should return from." ^ self home to the Inbox.
And I’ll think about #method/#homeMethod pair a bit more; but I guess this is right: homeMethod ^ self method
Best, Jaromir
From: Eliot Mirandamailto:eliot.miranda@gmail.com Sent: Tuesday, February 14, 2023 1:16 To: Jaromir Matasmailto:mail@jaromir.net Cc: The general-purpose Squeak developers listmailto:squeak-dev@lists.squeakfoundation.org Subject: Re: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
On Mon, Feb 13, 2023 at 12:10 AM Jaromir Matas <mail@jaromir.netmailto:mail@jaromir.net> wrote: Actually, FullBlockClosure >> home should be fixed too (returns nil for outerContext = nil):
FullBlockClosure >> home ^ outerContext ifNotNil: [ outerContext home ]
Fix:
FullBlockClosure >> home outerContext ifNotNil: [ ^outerContext home ]
I'm not sure about this. home answers a context. This fix would have home for a clean block answer the block itself. Is that what we want?
(P.S. feel free to make the other changes you're proposing)
From: Jaromir Matasmailto:mail@jaromir.net Sent: Sunday, February 12, 2023 23:44 To: squeak-dev@lists.squeakfoundation.orgmailto:squeak-dev@lists.squeakfoundation.org; Eliot Mirandamailto:eliot.miranda@gmail.com Subject: Re: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
Hi Eliot, I guess the same fix should apply for #methodReturnContext.
I wanted to ask about this: #home and #methodReturnContext are synonymous; why is that? Some backward compatibility thing or historical reasons?
Similarly I’ve noticed #method and #homeMethod seem synonymous too if I’m not mistaken (in BlockClosure and FullBlockClosure). Is it intentional?
Thanks, Jaromir
From: commits@source.squeak.orgmailto:commits@source.squeak.org Sent: Sunday, February 12, 2023 22:31 To: squeak-dev@lists.squeakfoundation.orgmailto:squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.orgmailto:packages@lists.squeakfoundation.org Subject: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
Eliot Miranda uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-eem.1498.mcz
==================== Summary ====================
Name: Kernel-eem.1498 Author: eem Time: 12 February 2023, 1:30:55.883243 pm UUID: e8b69d4d-8a07-4cf8-8ee7-d764b47f1981 Ancestors: Kernel-tpr.1497
In implementing BlockClosure>>hasMethodReturn, don't assume the byutecode set.
Implement Context>>#home so that it will code with clean blocks.
=============== Diff against Kernel-tpr.1497 ===============
Item was changed: ----- Method: BlockClosure>>hasMethodReturn (in category 'testing') ----- hasMethodReturn "Answer whether the receiver has a method-return ('^') in its code." | scanner endpc | + scanner := InstructionStream new method: self method pc: startpcOrMethod. - scanner := InstructionStream new method: outerContext method pc: startpcOrMethod. endpc := self endPC. + scanner scanFor: + [:byte | + scanner willReturn ifTrue: + [scanner willBlockReturn ifFalse: + [^true]]. + scanner pc >= endpc]. + ^false! - scanner scanFor: [:byte | (byte between: 120 and: 124) or: [scanner pc > endpc]]. - ^scanner pc <= endpc!
Item was changed: ----- Method: Context>>home (in category 'accessing') ----- home + "Answer the outermost context (along the static chain) for the receiver. + This is the outermost lexical scope in which the receiver's method is defined." - "Answer the context in which the receiver was defined."
+ ^closureOrNil + ifNil: [self] "normal method activation" + ifNotNil: "block activation" + [:closure| + closure outerContext + ifNil: [self] "clean block" + ifNotNil: [:outerContext| outerContext home]] "normal block"! - closureOrNil == nil ifTrue: - [^self]. - ^closureOrNil outerContext home!
-- _,,,^..^,,,_ best, Eliot
squeak-dev@lists.squeakfoundation.org