[comp.lang.c++] Exception handling and transaction management?

bhagwan@voodoo.UUCP (The Bhagwan) (06/23/89)

Hi,

	A vendor sent me a literature package including a reprint
	of the Release 1.0 newsletter. Here's a quote from it:

	"...features missing in C++ such as iterations (for handling
	collections), exception handling and robust transaction
	management."

	Can someone explain what exception handling is. I've heard this
	mentioned a number of times but do not really understand the
	concept as it applies to C++.

	Also, what's this "transaction management" stuff? Iterations?
	I'd call the people that publish the newsletter but I think
	I'll get more information in this forum.

Thanks,
-- 
Al McPherson		     Member Holstein Aerobatic Team
Boeing Computer Services     ...uw-beaver!ssc-vax!voodoo!bhagwan
P.O. Box 24346   MS: 6M-49   Seattle, WA  98124	   (206) 234-7825

grunwald@flute.cs.uiuc.edu (Dirk Grunwald) (06/25/89)

re: iterations

	basically, some linguistic concept that allows you to iterate
	over the contents of a class, e..g, a bag, a list, a whatever.

	while it's true that C++ doesn't have iterators, it's not clear
	that it needs them. Libg++ has the Pix (pseudo-index) class
	that resolves this problem (albeit, perhpas not as `nicely'
	as the iterators in clu).

	this is an important concept, but it's not clear that it needs
	linguistic methods to be possible.

re: exceptions	
	this, on the other hand, needs linguistic support. Basically,
	you want to say something like ``execute this <stuff>, and if
	you fail for some reason do this to recover''

	e.g., using the ``posit'' notation
	   posit
		open file
	   exception <read_only>
		print error message
		maybe signal another error
	   exception <no file descriptors left>
		close another open file & reloop

	exception handling can have either dynamic or static binding for
	exception names. you need to be able to ``unwind'' a stack when
	you've installed an exception handler.

	these aren't like signals in UNIX, because signals allow you to
	restart when you complete the signal handler. A formailism for
	that would be very nice too.

re: robust transaction processing
	mayhaps atomic actions? If you have exceptions & some concurrency
	mechanism, you can cover this up.


	
--
Dirk Grunwald -- Univ. of Illinois 		  (grunwald@flute.cs.uiuc.edu)

jima@hplsla.HP.COM (Jim Adcock) (07/06/89)

>re: iterations
>
>	basically, some linguistic concept that allows you to iterate
>	over the contents of a class, e..g, a bag, a list, a whatever.
>
>	while it's true that C++ doesn't have iterators, it's not clear
>	that it needs them. Libg++ has the Pix (pseudo-index) class
>	that resolves this problem (albeit, perhpas not as `nicely'
>	as the iterators in clu).
>
>	this is an important concept, but it's not clear that it needs
>	linguistic methods to be possible.

The emerging standard for iterators seems to be overloading operator()()
to provide interation.

See Lippman pgs 260-261, among other examples.  Then iteration becomes
something like:

anObject myInstance;
CollectionClass myCollection;

....

while (myInstance = myCollection())
{
  doSomethingWith(myInstance);
  ...
}

>re: exceptions	

Lippman pg 24 mentions "handle" -- actually changed since to "catch" -- but I
haven't found this keyword discussed anywhere.  Does anyone know if this
relates to exception handling?

schmidt@zola.ics.uci.edu (Doug Schmidt) (07/06/89)

In article <6590181@hplsla.HP.COM>, jima@hplsla (Jim Adcock) writes:
>>re: iterations
>>
>>  basically, some linguistic concept that allows you to iterate
>>  over the contents of a class, e..g, a bag, a list, a whatever.
>>
>>  while it's true that C++ doesn't have iterators, it's not clear
>>  that it needs them. Libg++ has the Pix (pseudo-index) class
>>  that resolves this problem (albeit, perhpas not as `nicely'
>>  as the iterators in clu).
>>
>>  this is an important concept, but it's not clear that it needs
>>  linguistic methods to be possible.
>
>The emerging standard for iterators seems to be overloading operator()()
>to provide interation.

There is a group of researchers at the University of Wisconsin that
are implementing an interesting C++ superset called E (I guess that's
really (C += 2) ;-)).  One useful extension they've added is Clu-style
iterators.

Here's a contrived example that demonstrates the usage:

----------------------------------------
iterator char *getstr (char **argv)
{
  while (*argv)
    yield *argv++;
}

main (int argc, char **argv)
{
  iterate (char *s = getstr (argv))
    printf ("item = %s\n", s);
}
----------------------------------------

The C++ syntax is quite clean (although the underlying generated C
implementation is pretty hairy).

In addition to iterators, the main language extensions that E provides
are generic classes (sort of like the templates described in
Stroustrup's paper), persistent data base types, and
honest-to-goodness nested classes (the way they are *supposed* to
work, i.e., like nested records in Ada or Pascal!!).

There is a tech report that describes the E language, also.

Doug Schmidt
--
Master Swordsman speak of humility;             | schmidt@ics.uci.edu (ARPA)
Philosophers speak of truth;                    | office: (714) 856-4034
Saints and wisemen speak of the Tao of no doubt;
The moon, sun, and sea speaks for itself. -- Hiroshi Hamada

schmidt@zola.ics.uci.edu (Doug Schmidt) (07/08/89)

In article <19176@paris.ics.uci.edu>, schmidt@zola (Doug Schmidt) writes:
>There is a tech report that describes the E language, also.

A number of people have asked me how to get details on E.  The
official channel for obtaining more information about E and Exodus, is
professor David DeWitt, (dewitt@cs.wisc.edu).  He encourages people to
contact him about obtaining a copy of the E compiler.

The title of the main E tech-report is:

----------------------------------------
``The Design of the E Programming Language'' by
Joel E. Richardson, Michael J. Carey, and Daniel T. Schuh

from the Computer Sciences Department
University of Wisconsin
Madison, WI 53706
----------------------------------------

Doug Schmidt
--
Master Swordsman speak of humility;             | schmidt@ics.uci.edu (ARPA)
Philosophers speak of truth;                    | office: (714) 856-4034
Saints and wisemen speak of the Tao of no doubt;
The moon, sun, and sea speaks for itself. -- Hiroshi Hamada