Deutsch   English   Français   Italiano  
<nnd$138a0c48$6e9b207c@a05ad5d81879a3a6>

View for Bookmarking (what is this?)
Look up another Usenet article

Date: Fri, 6 Jun 2025 12:47:12 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: THROW codes and ambiguous conditions
Newsgroups: comp.lang.forth
References: <f827ba6fc80427f3ce0317835bd8ae47a4445e07@i2pn2.org>
 <nnd$5d07338c$61b87fbd@d4d89ef8da41e19e>
 <nnd$110fb7e8$4dcc4e5b@7bbd872876625f12>
 <nnd$4a556964$65be8f1e@0fce8f78c54657e5>
 <d16b6924f6dae8d40a529e36e70bd03c50755741@i2pn2.org>
 <659bb0b01bc8680179097e1a4d976109@www.novabbs.com>
 <d4bc809862eacbe0c040817b94c218196c67d77f@i2pn2.org>
Content-Language: en-US
From: Hans Bezemer <the.beez.speaks@gmail.com>
In-Reply-To: <d4bc809862eacbe0c040817b94c218196c67d77f@i2pn2.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <nnd$138a0c48$6e9b207c@a05ad5d81879a3a6>
Organization: KPN B.V.
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!news.swapon.de!weretis.net!feeder8.news.weretis.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feed.abavia.com!abe004.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 47
Injection-Date: Fri, 06 Jun 2025 12:47:13 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"

On 04-06-2025 04:03, dxf wrote:
> True.  OTOH multilingual apps present a bigger problem than error msgs.
> I recall my telecom days when the bulk of the equipment was Siemens and
> technical manuals needed to be in English.  The scale was such it would
> have required a sizeable department just for that.

It may be my ignorance, but frankly, I don't see what the fuzz is all 
about. I build a centralized error handling routine in virtually all my 
programs, both C and Forth. And interfacing those with CATCH and THROW 
has never posed a problem. You can even define the behavior associated 
with a certain THROW value. Or set up handling per subsystem:

: Monitor                              ( xt -- n)
   catch dup                            \ start processing
   if throw-string s" Internal error: " >log >>message ;then drop
;                                      \ handle and log errors

: ReadCMDB                             ( --)
   ['] Startup  Monitor                 \ initialize the program
   ['] Process  Monitor                 \ process the data
   ['] Shutdown Monitor                 \ shutdown the system
;

E.g. this one is straight from my BASIC interpreter:

0= if
   begin drop ['] interpret catch dup until
then

ds.destroy .error

If an error is detected, it's value is passed to the .ERROR routine. And 
I assure you, it's quite easy to interface it with localization. So - 
what am I missing?

Now - whether I do return codes or exceptions depends on locality and 
fatality. If the error can be detected within the same module, I tend to 
like error codes. That's why I'd like to keep the main flow shallow 
(stages and subsystems).

Also - if there is no way to save grace, I tend to prefer exceptions. No 
need to wrestle through many layers carrying an error code.

Hans Bezemer