[BUG][DUMB USER] Refactoring Browser

squeak-dev at lists.squeakfoundation.org squeak-dev at lists.squeakfoundation.org
Fri Oct 25 23:25:43 UTC 2002


David,
A pleasure to see you're getting help from a real expert... 

Hi John :-)

David Farber <dfarber at numenor.com> wrote:
> 
> !! Indeed.
> 
> I hate it when the computer is smarter than I am.
> 
> OK, but after I moved the assignment to mboxStream out of the block and do an Extract method the UI gives me another head fake: when the dialog box comes up, it is /completely/ empty (ie, all of the controls are there, but there is no text in any of them--Where did the code that I am extracting go!?). Only after about 2 minutes do I realize that this is completely normal.
> 
> david
> 
> At 06:53 PM 10/25/2002 -0500, you wrote:
> >> From: squeak-dev-admin at lists.squeakfoundation.org [mailto:squeak-dev-
> >> admin at lists.squeakfoundation.org] On Behalf Of David Farber
> >> 
> >> [BUG]
> >> I've got the following method that I'd like to break up by applying
> >> Extract Method.
> >> 
> >> renderOn: html
> >> 
> >>   "Extract to 'self initMessage.'"
> >>   "Note: 'message' is an instance variable."
> >>   | mboxStream |
> >>   [mboxStream := FileStream fileNamed: 'HOS.mbx'.
> >>   message := RFC822Message fromMBOX: mboxStream.]
> >>     ensure: [mboxStream close].
> >> 
> >>   ...
> >> 
> >> When I try to extract the first block, I get an error: "Cannot extract
> >> assignment if read before written." This doesn't make sense as I don't
> >see
> >> anything that is getting read before written.
> >
> >It is complaining about mboxStream. You could define an #ensure: method
> >that evaluates the argument block before the receiver block, so the
> >reference to mboxStream in the argument block would read the value
> >before it was written. Or, more likely, the #fileNamed: message raises
> >an error and causes the "mboxStream close" to be run without mboxStream
> >ever being assigned. You should move the assignment of mboxStream
> >outside the block.
> >
> >
> >John Brant
> >
> >
> >
> >
> --
> David Farber
> dfarber at numenor.com



More information about the Squeak-dev mailing list