[squeak-dev] The Inbox: Kernel-fbs.736.mcz

Frank Shearar frank.shearar at gmail.com
Tue Feb 5 22:58:49 UTC 2013


On 4 February 2013 22:12, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
>
> On Sat, Feb 2, 2013 at 2:36 PM, Frank Shearar <frank.shearar at gmail.com>
> wrote:
>>
>> On 31 January 2013 22:59, Frank Shearar <frank.shearar at gmail.com> wrote:
>> > On 30 January 2013 20:04,  <commits at source.squeak.org> wrote:
>> >> Frank Shearar uploaded a new version of Kernel to project The Inbox:
>> >> http://source.squeak.org/inbox/Kernel-fbs.736.mcz
>> >>
>> >> ==================== Summary ====================
>> >>
>> >> Name: Kernel-fbs.736
>> >> Author: fbs
>> >> Time: 30 January 2013, 8:04:08.926 pm
>> >> UUID: 1d99c937-4c68-475c-987b-2990c8040c29
>> >> Ancestors: Kernel-fbs.735
>> >>
>> >> Rename NotImplemented errors in line with conventions 2 of 3.
>> >>
>> >> =============== Diff against Kernel-fbs.735 ===============
>> >
>> > If folks are happy with what I've got, I'd like to make one more
>> > change, and remove NotYetImplemented>>#defaultAction. This will make
>> > this message send open up a Debugger. Then I just need to tweak the
>> > Debugger to show the Create button.
>> >
>> > If people think that's sensible I'll make the change and resubmit,
>> > clearing out obsolete Inbox ancestors to show a more complete diff.
>>
>> Actually, I'm going to hold off on touching NotYetImplemented. I think
>> it's a good idea to remove the default action, but it and
>> #shouldBeImplemented have a wrinkle that I can't see right now how to
>> fix.
>>
>> Let's say you have Bar >> #ff [ self notYetImplemented ]. You evaluate
>> `Bar new ff` and the Debugger pops up, asking if you want to create
>> that method. You enter the desired behaviour - `^ 1` - and accept. The
>> stack now looks like this:
>>
>> Bar >> #ff (containing `^ 1`)
>> Bar >> #ff (containing `self notYetImplemented`)
>> <the topmost frame of the rest of the stack>
>> <the rest of the stack, ending in a DoIt>
>>
>> The topmost context returns, and _retriggers_ the exception. Instead,
>> we should _discard_ the `self notYetImplemented` stack frame and have
>> the new implementation return its result to <the topmost frame of the
>> rest of the stack>.
>>
>> It's probably not even hard, but my brain's a big mushy.
>
>
>     currentContext privSender: currentContext sender sender
> or
>     currentContext swapSender: currentContext sender sender

Yep yep: in Debugger >> implement:inClass:category: this looks to do the trick:

	<stuff>
	"Snip out of the call stack the context that raised the debugger. -
the #notYetImplemented send, for example."
	self selectedContext privSender: self selectedContext sender sender.
	self resetContext: self selectedContext.
	self debug.

Thanks for the tip! (I've done enough stack hacking that I should have
remembered this stuff. Sad times!)

frank

>> So instead I'd like to merge what I have, and add as a separate
>> enhancement
>> * removing NotYetImplemented >> #defaultAction
>> * returning to the sender sender context, <the topmost frame of the
>> rest of the stack>.
>>
>> This latter step should also avoid the problem of people not writing
>> their stubs as `^ self subclassResponsibility`, which prevents
>> seamlessly progressing with one's computation. (If you don't say `^`
>> then your new result-returning implementation returns its result to
>> the non-`^` stub/marker context, which returns self.)
>>
>> I want the experience of implementing missing functionality to be
>> almost like rewriting history - "we have always had this
>> implementation of this message". (To be read in the same voice as "We
>> have always been at war with Eurasia.")
>>
>> frank
>>
>
>
>
> --
> best,
> Eliot
>
>
>


More information about the Squeak-dev mailing list