Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #13201

THROW and iors

From stephenXXX@mpeforth.com (Stephen Pelc)
Newsgroups comp.lang.forth
Subject THROW and iors
Message-ID <4fe60471.71597048@192.168.0.50> (permalink)
Date 2012-06-23 18:04 +0000

Show all headers | View raw


I posted this around September 2006, but it was not the time. Now
some people seem to believe it is a good idea that ior return values
can be THROWn. Here it is again.

Stephen
=====================================
ThrowIors.txt
Stephen Pelc, 21 August 2006

Rationale
=========

Problem
-------
Error codes returned by some words, e.g. ALLOCATE are not specified,
and an application has no entitlement to use them as THROW codes.
The leads to very clumsy code of the form:

  ALLOCATE IF  <lit> THROW  ENDIF

or

: ?THROW    \ ior throwcode --
  SWAP IF  THROW  ELSE  DROP  THEN  ;

  ALLOCATE <lit> ?THROW

However, we also see many instances of code such as

  ALLOCATE THROW

which leads to silent aborts when a system issues -1 THROW (as
it is currently entitled to) or incorrect error messages.

Current practice
----------------
As far as possible within historical and commercial constraints,
MPE has attempted to make iors THROWable. The only downside has
been some necessary conversion of operating system error codes
to ANS or application error codes.

Some years ago, some people objected to making iors the same as
THROW codes because of the documentation overhead. This RfD is
made to sample opinion again, particularly among Forth system
implementers.

Solution
--------
All words which return an ior should have one value assigned in the
THROW code table (Table 9.2 in 9.3.5). This table reserves values
-1..-255 for system-defined exceptions. Systems that ignore this
proposal are unaffected if they already avoid these values, and
systems that implement this proposal gain use of these new fixed
iors.

The only downside is that we have to define some new THROW codes.

Proposal
========
Extend the THROW code table (Table 9.2 in 9.3.5) so that there is
a separate THROW code for each word that returns an ior.

Labelling
=========
ENVIRONMENT? impact - table 3.5 in Basis1
  name   stack   conditions

THROW/ior impact - table 9.2 in Basis1
  value  text



-- 
Stephen Pelc, stephenXXX@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads

Back to comp.lang.forth | Previous | NextNext in thread | Find similar


Thread

THROW and iors stephenXXX@mpeforth.com (Stephen Pelc) - 2012-06-23 18:04 +0000
  Re: THROW and iors Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-23 23:17 +0200
    Re: THROW and iors "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-06-24 04:17 -0400
      Re: THROW and iors Coos Haak <chforth@hccnet.nl> - 2012-06-25 22:02 +0200
  Re: THROW and iors anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-24 13:01 +0000
  Re: THROW and iors Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-06-25 05:01 -0700
    Re: THROW and iors Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-26 01:08 +0000
      Re: THROW and iors jfong <jfong@ms4.hinet.net> - 2012-06-25 20:13 -0700
        Re: THROW and iors BruceMcF <agila61@netscape.net> - 2012-06-26 10:18 -0700
          Re: THROW and iors jfong <jfong@ms4.hinet.net> - 2012-06-26 18:53 -0700
            Re: THROW and iors Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-02 21:36 -0700
              Re: THROW and iors anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-03 13:34 +0000
                Re: THROW and iors Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-03 21:37 -0700

csiph-web