473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

The history of throw?

I just read the section in _The_GNU_Emacs_Lisp_Reference_Manual_
on /Explicit/ /Nonlocal/ /Exits/[*] and had to wonder what language first
introduced the idea of throwing, catching, and unwinding. Note that
(Emacs) Lisp does not have something called 'exception', nor does it have a
'try' keyword. So what we find in C++ is certainly not taken from Lisp
without modification if indeed it was influenced by Lisp at all. I've read
that the concept of 'stack unwinding' was borrowed from Lisp. Does anybody
know the details of this history?

http://www.gnu.org/software/emacs/el...30.html#SEC130
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

Jul 22 '05 #1
12 1216
"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message
news:qr********************@speakeasy.net...
I just read the section in _The_GNU_Emacs_Lisp_Reference_Manual_
on /Explicit/ /Nonlocal/ /Exits/[*] and had to wonder what language first
introduced the idea of throwing, catching, and unwinding.


Probably PL/I, in approximately 1968.
Jul 22 '05 #2
Steven T. Hatton wrote:

What language first introduced the idea of throwing, catching, and unwinding.


Fortran.

"The alternate RETURN allows a procedure to return
to one of the several labelled statenebts in the calling program unit
dependent upon the value of an integer variable."
Jul 22 '05 #3
E. Robert Tisdale wrote:
Steven T. Hatton wrote:

What language first introduced the idea of throwing, catching, and
unwinding.

Fortran.

"The alternate RETURN allows a procedure to return
to one of the several labelled statenebts in the calling program unit

to one of the several labelled statements in the calling program unit dependent upon the value of an integer variable."

Jul 22 '05 #4
"Andrew Koenig" writes:
I just read the section in _The_GNU_Emacs_Lisp_Reference_Manual_
on /Explicit/ /Nonlocal/ /Exits/[*] and had to wonder what language first
introduced the idea of throwing, catching, and unwinding.


Probably PL/I, in approximately 1968.


Just a guess, but my guess is PL/I also.
Jul 22 '05 #5
E. Robert Tisdale wrote:
Steven T. Hatton wrote:

What language first introduced the idea of throwing, catching, and
unwinding.


Fortran.

"The alternate RETURN allows a procedure to return
to one of the several labelled statenebts in the calling program unit
dependent upon the value of an integer variable."

As regards C++, which was the overall topic of my post, I must say there are
many aspects of Lisp error handling combined with catch and throw that seem
to clearly indicate a common origin. Even the concept of RAII seems to be
present. There are differences, but I am specifically interested in what
influences contributed to C++'s exception handling mechanism. Here is a
list of similarities I've noticed between Lisp and C++ regarding C++'s
exception handling.

The use of catch and throw. Note that in Lisp these are not intended
primarily for error handling, but they have clear similarities with the
error handling mechanism.

The use of error symbols is very similar to the use of exceptions in C++.
* Error symbols are arranged in a hirearchie with 'error' at the root. This
is analogous to the derivation hirearchie in the Standard Library.
* Error symbols carry with them a string intended for printing human
readable messages. This is analogous to the string returned by
std::exception::what() in C++
* Error symbols are passed up the call stack to until they encounter a
handler that accepts their type. Clearly analogous to the C++ mechanism of
using multiple catch() statements.
* If no handler is encountered, the process is terminated.

As the forms are exited, all local variable are unbound.

Though technically more similar to Java's finally than C++'s destructor, the
'unwind-project' 'cleanup-forms' serve an analogous purpose. To use C++
terminology, they ensure the essential invariants are preserved: " The
unwind-protect construct is essential whenever you temporarily put a data
structure in an inconsistent state; it permits you to make the data
consistent again in the event of an error or throw."
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

Jul 22 '05 #6
In message <cl**********@nntp1.jpl.nasa.gov>, E. Robert Tisdale
<E.**************@jpl.nasa.gov> writes
Steven T. Hatton wrote:
What language first introduced the idea of throwing, catching, and
unwinding.


Fortran.

"The alternate RETURN allows a procedure to return
to one of the several labelled statenebts in the calling program unit
dependent upon the value of an integer variable."


That's just syntactic sugar for writing "if (<hidden return value>) goto
<a label elsewhere in this function>;" immediately after the function
call. There's no equivalent of unwinding the call stack or catching.

--
Richard Herring
Jul 22 '05 #7
Richard Herring wrote:
E. Robert Tisdale writes:
Steven T. Hatton wrote:
What language first introduced the idea of throwing, catching, and
unwinding.


Fortran.

"The alternate RETURN allows a procedure to return
to one of the several labelled statements in the calling program unit
dependent upon the value of an integer variable."


That's just syntactic sugar for writing
"if (<hidden return value>) goto <a label elsewhere in this function>;"
immediately after the function call.
There's no equivalent of unwinding the call stack or catching.


Neither Fortran or C++ specify a stack much less stack unwinding.
The point is that the notion of exception handling appears
in the earliest high level computer programming languages.
Jul 22 '05 #8
"E. Robert Tisdale" writes:
The point is that the notion of exception handling appears
in the earliest high level computer programming languages.


Tell us what facilities for handling exceptions were provided in Fortran II.
Jul 22 '05 #9
E. Robert Tisdale wrote:

Neither Fortran or C++ specify a stack much less stack unwinding.
The point is that the notion of exception handling appears
in the earliest high level computer programming languages.


Actually, while C++ doesn't define the stack (at least not in
the concept of using it for subroutine linkage), it does use
the term "stack unwinding" in the description of getting from
the point of throw to the catch, destroying local variables
along the way.
Jul 22 '05 #10
In article <41***********************@news.newshosting.com> ,
Ron Natalie <ro*@sensor.com> wrote:
E. Robert Tisdale wrote:

Neither Fortran or C++ specify a stack much less stack unwinding.
The point is that the notion of exception handling appears
in the earliest high level computer programming languages.
Actually, while C++ doesn't define the stack (at least not in
the concept of using it for subroutine linkage),


It does define a subroutine call mechanism that's required to look,
feel, and smell like a stack, though.
it does use
the term "stack unwinding" in the description of getting from
the point of throw to the catch, destroying local variables
along the way.


Wouldn't it be the (abstract) function-invocation stack that this refers
to, and not necessarily something like the hardware-supported stack that
most general-purpose processors use to implement such a thing?
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
The perfect tool when you want output in a rigid column format at the
possible expense of the data integrity.
--Kaz Kylheku in comp.lang.c
Jul 22 '05 #11
In message <cl**********@nntp1.jpl.nasa.gov>, E. Robert Tisdale
<E.**************@jpl.nasa.gov> writes
Richard Herring wrote:
E. Robert Tisdale writes:
Steven T. Hatton wrote:

What language first introduced the idea of throwing, catching, and
unwinding.

Fortran.

"The alternate RETURN allows a procedure to return
to one of the several labelled statements in the calling program unit
dependent upon the value of an integer variable." That's just syntactic sugar for writing
"if (<hidden return value>) goto <a label elsewhere in this function>;"
immediately after the function call.
There's no equivalent of unwinding the call stack or catching.


Neither Fortran or C++ specify a stack much less stack unwinding.


The words "stack" and "unwinding" may not be used, but C++ provides for
(a) transferring control *an unspecified number of layers layer out* in
a sequence of nested function calls, (b) cleaning up everything which
goes out of scope as a result of this.

Fortran doesn't.

The point is that the notion of exception handling appears
in the earliest high level computer programming languages.


Possibly, but you haven't demonstrated it.

--
Richard Herring
Jul 22 '05 #12
Richard Herring <ju**@[127.0.0.1]> wrote in message news:<k$**************@baesystems.com>...

[ ... ]
The point is that the notion of exception handling appears
in the earliest high level computer programming languages.


Possibly, but you haven't demonstrated it.


FORTRAN didn't. PL/I would be the next obvious choice -- it not only
had exception handling, but more or less forced its use on a regular
basis, because it used it for quite a few situations that really
weren't exceptional. One obvious example was reading a file, with the
end of the file being signaled by an exception.

It's certainly true that PL/I's exception handling was (both
syntactically and semantically) substantially different from C++'s,
but I think almost anybody who studied the two would agree that the
similarities are sufficient to say it really WAS exception handling as
the term is normally used.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 22 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Ashot | last post by:
This is sort of both Python and Vim related (which is why I've posted to both newsgroups). Python related: ---------------------- I have been frustrated for quite some time with a lack of a...
10
by: pmelanso | last post by:
Hello, How can I tell if there is a page to go back to in the history or not??? Same with forward??? say something like/// if (there is a page to go back to ) { // DO something }else { }
20
by: Dan | last post by:
Is there a way to obtain the last page visited? I don't want to go to that page, I just want to be able find out what page they came from, the url of that page. Is this possible?
3
by: pentisia | last post by:
Hi there, We are using history.go(integer) to go back to the certain page directly. Because there are some pages interaction in between. For example, starting from page 1 to page 2. From page...
3
by: Niall | last post by:
When I say 'last', I mean (eg.) the 100th item in a 100-item history list, *not* the immediately previous one! The problem is, the history.go() method only allows *relative* movement through...
1
by: Randy | last post by:
I have an application with a datagrid and a button to export the grid to excel. For the most part this is working fine. Here's the export method: Private Sub btnExcel_Click(ByVal sender As...
10
Ajm113
by: Ajm113 | last post by:
Making a History Page for BIG Sites Intro: Ok, let's say after a while your website has grown massive. We're talking search engine, forum and video hosting -- you've got a LOT of content. And you...
0
by: lemnitzer | last post by:
Full Article: http://iamthewitness.com/FreedmanFactsAreFacts.html <-------- KEY DOCUMENT Steamy Excerpts: Will you be patient with me while I review here as briefly as I can the history of...
2
by: Max | last post by:
I recently moved to ASPnet Ext 3.5 What I can't get with Ajax and History browser managemet is this: User fills some fields (dropdown and textbox) on page 1 (all are in an update panel) User...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.