[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
Re: "forEach:" and manual deletion
- To: <vlad!mark>, <xtech@xxxxxxxxxxx>
- Subject: Re: "forEach:" and manual deletion
- From: Michael McClary <joe-bob!michael>
- Date: Sat, 1 Sep 90 19:42:20 PDT
> From vlad!mark Wed Jul 18 20:10:39 1990
(This got pushed behind my mail-horizon, so it waited until I was
cleaning out the mailbox during the second grand-compile of the day.)
> I advocate that the loop that Smalltalk's "forEach:" translates to
> delete (or destroy?) the "while_Stepper" after the close of the loop.
> By the time you exit the loop, the stepper is necessarily exhausted,
> so it's hard to see what use it would be to anyone. This would not be
> a strictly upwards compatable change, but I strongly suspect it would
> actually be compatable with all the code we actually have. Does
> anyone know of any examples where a stepper is used (or even held
> onto) after being stepped to exhaustion?
The only problem I can see is with the idiom for "step along until you
find what you're looking for or run out of candidates". One natural
C/C++ idiom would be to break from the loop, then ask the stepper whether
it's exhausted.
What's the smalltalk idiom? As I recall, breaks are a pain in Smalltalk.
If, as I suspect, it is something else entirely, that translates to something
reasonable in C++, I see no other reason not to make stepper deletion
automatic.
(Yay! One less thing for the GC to worry about.)
michael