dialogues in non-gui code

Stephen Pair spair at advantive.com
Mon Dec 13 13:51:44 UTC 1999


------=_NextPart_000_0012_01BF4547.484550C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit




> On the other hand, this is madening if you write code that isn't
> intended to be triggered from the UI.  As a case in point, it's
> aggravating that a network server might call a socket routine and cause
> debug windows to pop up for routine things like timeouts and dropped
> connections.

Precisely the situation I recently encountered.

> The ideal solution would be to have the popups when the UI is around,
> and not to have the popups when it isn't.  Perhaps exceptions would work
> for this?  The UI defines special exception handlers for cases like
> file-not-found, and non-UI code can simply catch the exception itself.
> Has anyone worked in a system that takes this approach?

I actually just implemented this last week.  The attached change set defines
a FileDoesNotExist exception and signales it from #oldFileNamed:.  The
exception prompts the user.  One thing I don't like however, is being forced
to define a class for such a simple task.  I think in this situation I would
have preferred the old VW style instance based approach to exceptions.  It
would be nice if the exception framework were extended to easily accomodate
both styles out of the box.  Then again, with a class there, anyone
encountering a similar file not found situation can make use of this
exception.

This brings up another issue that I found in
StandardFileStream>>open:forWrite:...it forces a GC if it cannot open the
file in question.  I understand why this is done (a file could be open that
will be closed on finalization), but it seems like it introduces unexpected
performance hit.  (p.s.  I'm still using 2.5 at this point, so maybe it's
different in 2.7)

- Stephen

------=_NextPart_000_0012_01BF4547.484550C0
Content-Type: text/plain; name="FileStreamNoUIFix.13Dec839am.cs"
 ; x-mac-type="65417070"
 ; x-mac-creator="43534F6D"
Content-Disposition: attachment; filename="FileStreamNoUIFix.13Dec839am.cs"
Content-Transfer-Encoding: imap_stub

0,2309,2,2113,0,

------=_NextPart_000_0012_01BF4547.484550C0--





More information about the Squeak-dev mailing list