home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / forth / 3010 < prev    next >
Encoding:
Internet Message Format  |  1992-08-22  |  4.6 KB

  1. Path: sparky!uunet!gatech!pitt!willett!ForthNet
  2. From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie)
  3. Newsgroups: comp.lang.forth
  4. Subject: Environmental Queries
  5. Message-ID: <4008.UUL1.3#5129@willett.pgh.pa.us>
  6. Date: 22 Aug 92 13:27:32 GMT
  7. Organization: EIEI-U
  8. Lines: 104
  9.  
  10. Category 10,  Topic 33
  11. Message 11        Fri Aug 21, 1992
  12. B.RODRIGUEZ2 [Brad]          at 22:52 EDT
  13.  
  14.                  ANSI X3J14 FORTH TECHNICAL PROPOSAL
  15.                      (X3J14 dpANS-3, March 1992)
  16.  
  17. TITLE:  ENVIRONMENT? should take text from input stream
  18.  
  19. SECTION:  6.1.1345 ENVIRONMENT?
  20.  
  21. SUMMARY:  ENVIRONMENT? should take its argument from the input
  22.      stream, and not from the stack.  A new name is suggested.
  23.  
  24. PROPOSAL:  Change section 6.1.1345 to the following:
  25.  
  26.      6.1.1345 ENVIRONMENTAL                            CORE
  27.  
  28.           ( "name" -- false | value true )
  29.  
  30.           Parse name delimited by a space, ignoring leading
  31.           delimiters.  name should be a keyword from 3.1.4
  32.           Environmental Queries or the optional word sets to be
  33.           checked for correspondence with an attribute of the
  34.           present environment.  If the system treats the
  35.           attribute as unknown, the returned flag is false;
  36.           otherwise, the flag is true and the value returned is
  37.           of the type specified in the table for the attribute
  38.           queried.
  39.  
  40.      Note: the name ENVIRONMENTAL is proposed to avoid confusion
  41.      with the existing word ENVIRONMENT?, and for better
  42.      readability.  The Technical Committee may change the name of
  43.      this word without altering the intent of this proposal.
  44.  
  45. RELATED PROPOSALS:  'S" should be interpretive in CORE'
  46.  
  47. DISCUSSION:  ENVIRONMENT? is flawed in that it requires a string
  48.      argument.  This is unusual, and is not common Forth practice
  49.      for a word of this nature; but more significantly, there is
  50.      no truly portable means to obtain such a string argument
  51.      while compiling a program.  (See the related proposal for a
  52.      discussion of this problem.)
  53.  
  54.      A more common Forth practice is to pick up a string argument
  55.      from the input stream.  This would also serve to improve
  56.      readability of the code.  For example, the phrase
  57.           ENVIRONMENTAL MAX-N
  58.      is more readable and less cryptic than
  59.           S" MAX-N" ENVIRONMENT?
  60.  
  61.      By parsing its argument from the input stream, ENVIRONMENTAL
  62.      eliminates the need for an interpretive S", which (I have
  63.      been told) presents a problem to some Forth systems.
  64.  
  65.      Also, this definition of ENVIRONMENTAL is readily applicable
  66.      to Forth cross-compilers.
  67.  
  68.      ENVIRONMENTAL can be readily defined in terms of the previ-
  69.      ous dpANS word:
  70.           : ENVIRONMENTAL   BL WORD COUNT ENVIRONMENT? ;
  71.      Indeed, it has been pointed out informally that this is how
  72.      the Technical Committee expects ENVIRONMENT? to be used.  If
  73.      this is so, then it is the word ENVIRONMENTAL which should
  74.      be standardized.
  75.  
  76.      Note: if the related proposal, 'S" should be interpretive in
  77.      CORE' is adopted, this proposal is not withdrawn.  Whatever
  78.      the disposition of S", I believe that ENVIRONMENTAL is
  79.      preferable to ENVIRONMENT?.
  80.  
  81.      Objections.
  82.  
  83.      It has been suggested that, for utmost flexibility, an
  84.      environmental query word is required which accepts an argu-
  85.      ment on the stack rather than in the input stream.  There
  86.      are three responses to this:
  87.  
  88.      a) this is a purely hypothetical need: no example of where
  89.      this would be useful has been offered.
  90.  
  91.      b) the Technical Committee has not seen fit to do this for
  92.      such fundamental words as CREATE, so one may presume that
  93.      this kind of flexibility is not considered an essential part
  94.      of dpANS Forth.
  95.  
  96.      c) I have no objection to retaining the word ENVIRONMENT? as
  97.      an auxiliary word, as long as the word ENVIRONMENTAL remains
  98.      in the Core word set.  I would suggest that ENVIRONMENT? be
  99.      placed in the Core Extensions or other optional word set.
  100.  
  101.      I maintain that ENVIRONMENTAL is the word that must be in
  102.      the Core word set.  The fact that it can be defined in terms
  103.      of ENVIRONMENT? is untrue for cross-compilers, a realm in
  104.      which environmental queries will be particularly important.
  105.      By specifying ENVIRONMENTAL as the Standard word, we define
  106.      an environmental query mechanism that can be used in all
  107.      environments.
  108.  
  109. -----
  110. This message came from GEnie via willett.  You *cannot* reply to the author
  111. using e-mail.  Please post a follow-up article, or use any instructions
  112. the author may have included (USMail addresses, telephone #, etc.).
  113. Report problems to: dwp@willett.pgh.pa.us
  114.