From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!paganini.linuxd.org!news.fcku.it!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Thu, 30 Jul 2015 11:19:56 +0200 Organization: cbb software GmbH Message-ID: <1ggy6i9vo127j.2qyngc2388wo.dlg@40tude.net> References: <2df4698f-4c8e-457c-822d-209cb2f8ab5e@googlegroups.com> <014427b1-ff7a-4a69-82e6-0330af77ed96@googlegroups.com> <91f88d79-197c-419f-84a8-908e05967a2c@googlegroups.com> <135c2b00-d13c-4f5d-a586-8aca442d363b@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: ChlmA4XFxcJoDoqGdDSflw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.giganews.com comp.lang.ada:194496 Date: 2015-07-30T11:19:56+02:00 List-Id: On Thu, 30 Jul 2015 01:45:18 -0700 (PDT), EGarrulo wrote: > Exceptions in Ada cannot carry contextual information, Which is right and important, semantically. The context is dead, not carrying corpses... Ada's model (and of C++ as well) is leave first, handle later. An alternative model in early languages, like in PL/1: handle, then return, proved to be useless. > Where > is the usefulness of knowing that something has gone awry, > without any context? Of course there is a context, this is the context of the handler. See above, it is an important semantic of the design. An exceptional state is one that *cannot* be handled on the context it occurred. That is the whole idea. If you could handle it, you would right at the point. Exception propagation is looking for a context where you can handle the exception. Note also decoupling, an important thing from the SW design POV. Neither context need not to know anything about the other. > For example: "'File not found?' What file > was the program trying to open, and why?" Yes, how the OS (the exception context) is supposed to know this? The handler's context knows it fine, because it is where file was attempted to open. > In embedded software, > it makes sense to avoid memory allocations while raising an > exception, but elsewhere? Everywhere. It is about limiting the side effects of an action. Exceptions, since more than frequently, are misused for dealing with bugs, are first candidates to limit side effects as much as possible. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de