Newsgroups: comp.edu,comp.lang.ada,comp.lang.c++,comp.lang.modula2,comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!purdue!lerc.nasa.gov!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!nntp.crl.com!pacbell.com!gw2.att.com!nntpa!not-for-mail
From: ka@socrates.hr.att.com (Kenneth Almquist)
Subject: Re: Comparison of languages for CS1 and CS2
Message-ID: <DBqqC7.H8B@nntpa.cb.att.com>
Sender: news@nntpa.cb.att.com (Netnews Administration)
Nntp-Posting-Host: socrates.hr.att.com
Organization: AT&T
References: <3tsm2d$s8k@felix.seas.gwu.edu> <3tud2t$k6d@wdl1.wdl.loral.com> <3u3fju$f3l@watnews1.watson.ibm.com> <3u3oan$gad@wdl1.wdl.loral.com> <3u5u12$187s@watnews1.watson.ibm.com>
Date: Sat, 15 Jul 1995 04:40:55 GMT
Lines: 20
Xref: glinda.oz.cs.cmu.edu comp.edu:13329 comp.lang.ada:32721 comp.lang.c++:138641 comp.lang.modula2:12080 comp.lang.scheme:13208

> my prejudice is that if a situation is normal enough to give the
> in out and out parameters predictable values, it's too normal to signal
> by propagating an exception, which forces a transfer of control upon the
> caller.  The situation should be signalled instead by a status parameter.

For OUT parameters I agree with you.  On the other hand, it is desirable
for operations of an abstract data type to refrain from damaging anything
if they fail.  For example:

> If the call Enqueue (Item, Queue) propgates a queue-full exception,
> should we assume that Queue is still intact and safe for further use, or
> should we take this as an indication that something is terribly wrong?

If you are designing a Queue abstraction, you shouldn't worry about that.
Just specify that if Enqueue is called when the queue is full, Queue_Full
is raised and the queue is not modified.  Since the Queue is in a consistent
state when Queue_Full is raised, the exception handler can either delete
the Queue or continue to use it.  You want to be able to change what the
exception handler does without changing the Queue abstraction.
				Kenneth Almquist
