From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie)
Newsgroups: comp.lang.forth
Subject: Environmental Queries
Date: 22 Aug 92 13:27:28 GMT
Organization: EIEI-U

Category 10,  Topic 33
Message 10        Fri Aug 21, 1992
B.RODRIGUEZ2 [Brad]          at 22:49 EDT
 
                 ANSI X3J14 FORTH TECHNICAL PROPOSAL
                     (X3J14 dpANS-3, March 1992)

TITLE:  S" should be interpretive in CORE

SECTION:  6.1.2165 S"
          11.1.2165 S"
          see also 6.1.1345 ENVIRONMENT?

SUMMARY:  An interpretive S" is needed to perform environmental
     query, which is a Core function.

PROPOSAL:  Change the text of section 6.1.2165 to text of section
     11.1.2165, and then delete section 11.1.2165.  (This is to
     move the interpretive behavior of S" to the Core word set.)

RELATED PROPOSALS:  "ENVIRONMENT? should take text from input
     stream"

DISCUSSION:  Another major weakness in the ENVIRONMENT? concept
     is that there is only one portable means to query
     ENVIRONMENT? in an ANS Forth core system, and this means is
     clumsy, unobvious, and inapplicable to cross-compilers.

     This is because there is only one portable way in a core
     system to obtain a text string interpretively: by executing
     a newly-created definition that contains an S", e.g.,
          : "MAX-N"   S" MAX-N" ;
          "MAX-N" ENVIRONMENT? ...
     which is clumsy, and not truly portable -- most Forth cross-
     compilers, for instance, would be unable to execute this,
     since the execution environment ("target") and the compila-
     tion environment are separate and distinct.

     At present, the only way to use S" interpretively is to
     declare an environmental dependency on the File-Access word
     set.  This is contrary to the purpose of ENVIRONMENT?, which
     is intended to allow all Forth systems to be portably
     queried.

     This proposal would rectify the problem by allowing inter-
     pretive use of S" in the Core word set.

     Note: if the related proposal, "ENVIRONMENT? should take
     text from input stream" is adopted, then I withdraw this
     proposal as no longer being necessary.

     Objections.

     It has been pointed out that most implementors will include
     an interpretive behavior for S" anyway, and so it need not
     be included in the standard.  This overlooks the fact that,
     no matter what is provided by the vendors, no program can be
     a "Standard Program" if it uses S" interpretively.  At best,
     it can only be a Standard Program with an environmental
     dependency on the File-Access word set.

     If all implementors will include interpretive S", there is
     no harm in mandating this behavior in the standard.  If this
     is how the Committee believes ENVIRONMENT? should be used,
     interpretive S" should be mandated in the standard.

     It has been suggested (ref. Doc. No. X3J14/92-1PRC18R) that
     other portable means exist.  This statement is incorrect.

          BL WORD COUNT  cannot be used interpretively; again, a
          new definition must be created and executed.

          PAD 80 SOURCE-FILE READ-LINE also requires the File-
          Access word set.  Also, it can only be used when load-
          ing from files; a different construct is needed for
          loading from blocks, and no analogous construct exists
          for interpretive use from the keyboard.

     It has been suggested that new definitions can be created by
     the user to rectify these shortcomings, e.g.,
          : ENVIRONMENTAL   BL WORD COUNT ENVIRONMENT? ;
          ENVIRONMENTAL MAX-N ...
     There are three responses to this:

     a) it is not obvious to the programmer that this technique
     is required to guarantee portability.  Most ANS Forth users
     will doubtless employ the non-Standard
     S" MAX-N" ENVIRONMENT?, especially if their implementations
     allow this usage.

     b) as noted previously, techniques that require the execu-
     tion of new definitions are inapplicable to cross-compilers.
     While the dpANS does not now address the issue of cross-
     compilers, it would be unconscionable to require a technique
     that cannot later be extended to cross-compilers, especially
     for so fundamental an operation as environmental queries.

     c) if this is the means by which the Committee feels that
     ENVIRONMENT? should be used, then this should be the means
     specified by the Standard!  (See related proposal.)

-----
This message came from GEnie via willett.  You *cannot* reply to the author
using e-mail.  Please post a follow-up article, or use any instructions
the author may have included (USMail addresses, telephone #, etc.).
Report problems to: dwp@willett.pgh.pa.us