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: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Thu, 30 Jul 2015 16:31:37 +0200 Organization: A noiseless patient Spider Message-ID: 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: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 30 Jul 2015 14:30:03 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="1489"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7w5MHP7g8+51W6wIiYfU9EQZjQlsiVAY=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: Cancel-Lock: sha1:zpHAs2VHc5/uzw2MiACmgamugtM= Xref: number.nntp.giganews.com comp.lang.ada:194521 Date: 2015-07-30T16:31:37+02:00 List-Id: On 30.07.15 10:45, EGarrulo wrote: >> I'm still >> not sure anything but messages should go with exceptions: it is >> too tempting for consultants to apply techniques of obfuscation >> via exception classes. Even involuntarily! > > Could you explain further, please? Dmitry has explained the context for a handler. As you explained "chaining", exceptions can propagate and be exchanged for different exceptions, perhaps after intermediate handling. But all the "programming" and "executing" going on when exceptions are regular objects, or when exception messages are concatenated, is dubious IMHO. Hack-ish. Instead, in languages without pre-allocated environments such as Ada or C++, I'd rather do bookkeeping of all information that is needed for restarting, if possible, at any level of handling. Conceptually, maybe not always applicable: declare P : Protocol; -- representing known good state begin -- either pass P to Op, or maybe have -- Op use P as a relatively global variable Op (...); exception when Not_Program_Error_Etc => -- we now have a P ready for inspection ... end; In fact, sometimes this is the only way one can handle exceptions across task borders; Google's App Engine is one example. One process never knows what is going on in some separate process unless the other process leaves information in the datastore, at some location known to both processes. Involuntary obfuscation happens when the programmer codes any knowledge of various parts of a program into exception types: If a programmer knows two different parts of the program, defines the exception's type in one and uses the thrown object in the other, there is no trace of this knowledge in the program's source text. IOW, knowing the conditions of non-local flow entirely depends on good will, discipline, conventions, documentation, etc., but not on language. That's unlike P above: both parts, the one that finally raises, as well as the handling part will refer to it. It doesn't look elegant, but it works in general.