home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / rexx / 746 < prev    next >
Encoding:
Text File  |  1992-08-19  |  6.3 KB  |  138 lines

  1. Newsgroups: comp.lang.rexx
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!ugle!anders
  3. From: anders@lise11.lise.unit.no (Anders Christensen)
  4. Subject: Re: Capturing System Command Output (was: SH Backquote)
  5. In-Reply-To: SEB1525@MVS.draper.com's message of Wed, 19 Aug 1992 14:00:00 GMT
  6. Message-ID: <ANDERS.92Aug19231649@lise11.lise.unit.no>
  7. Sender: news@ugle.unit.no (NetNews Administrator)
  8. Organization: /home/flipper/anders/.organization
  9. References: <ANDERS.92Aug18223235@lise8.lise.unit.no>
  10.     <19920819090033SEB1525@MVS.draper.com>
  11. Date: 19 Aug 92 23:16:49
  12. Lines: 124
  13.  
  14. In article <19920819090033SEB1525@MVS.draper.com> SEB1525@MVS.draper.com (Steve Bacher) writes:
  15.  
  16. > In article <ANDERS.92Aug18223235@lise8.lise.unit.no>,
  17. > anders@lise8.lise.unit.no (Anders Christensen) writes:
  18.  
  19. > >The three different _conceptual_ methods that I am aware of are
  20. > [following very abbreviated]
  21. > >
  22. > >      files = 'ls'(directory)
  23. > >      'ls' directory ' >LIFO'     /* or "|rxstack" */
  24. > >       'ls | rxstack'
  25. > >      rcode = popen( "ls" directory,, "ls-output" )
  26. > Er, our *four* different conceptual methods...?
  27.  
  28. No, three. _For_the_user_ it is three different conceptual methods,
  29. since both ">LIFO" and "|rxstack" is the same Rexx programming
  30. concepts. The concepts of implementation, well that is a completely
  31. different thing.
  32.  
  33. I'd like this debate to differ between the concepts of Rexx
  34. programming, and concepts of implementation. It is important to design
  35. a good syntax, and _then_ do the implementation, instead of deciding
  36. on an implementation and the design a suitable syntax for it. 
  37.  
  38. In the latter case, you are going to get an syntax ridden with
  39. implementation specific details and lots of special cases. And it will
  40. probably only be really useful to the persons that know the opsys
  41. specific details that the implementation builds on. If the point of
  42. view is: "Wouldn't it be nice if feature XXX of opsys YYY would be
  43. available in Rexx?" You are guaranteed to get: 1) unportable Rexx
  44. implementations; 2) unportable Rexx scripts; 3) 'unportable' Rexx
  45. users (knowing Rexx is not enough to move to another platform, you
  46. have to know the features of the operating system too).
  47.  
  48. Therefore, can we discuss a _syntax_ first, and try to keep concepts
  49. of how to _implement_ that syntax away until we have evaluated how
  50. good the various syntaxes are, and we need to know how implementable
  51. they are?
  52.  
  53. > Just from the UI POV, how about a fifth:
  54. >
  55. >      rcode = queue_to_stack("ls" directory)
  56.  
  57. OK, this very well illustrates the the main conceptual question, which
  58. is : COMMANDS vs FUNCTIONS.
  59.  
  60. The '>LIFO' and '|rxstack' methods are COMMAND-driven, all the other 
  61. are FUNCTION-driven. I'd like to see a good command-driven interface.
  62. And why? Because the concept of "anything not a keywords falls through
  63. to the outer environment" is just so elegant. A rexx program is
  64. basically just a list of commands to an environment. And then you can
  65. add Rexx keywords to create a structure in those commands. That is the
  66. the magic of Rexx: The structure of a programming language to be added
  67. on top of an unintelligent command interpreter. 
  68.  
  69. On the other hand, in a function-driven based approach, the commands
  70. are put _into_ the Rexx language, as parameters to Rexx functions. I
  71. think that is far less elegant, and (more important) I think that the
  72. resulting code and structure is far less obvious.
  73.  
  74. > Similar syntactically to popen(), but captures stdout and puts it
  75. > on the data stack or in stem variables a la EXECIO.
  76.  
  77. There are three different approaches: 1) put it on the stack; 2) put
  78. it into variables; and 3) let it be an expression. All of them have
  79. weeknesses and strengths, so perhaps all three should be possible to
  80. do. But what _syntax_ to use for each single method?
  81.  
  82. > And what about stderr?  Maybe an optional third argument could
  83. > specify the destination for stderr.  (Let's not get fancy and
  84. > start specifying destinations for file descriptor numbers...)
  85.  
  86. Well, 'stderr' is a Unix-concept. If the starting point is "how to
  87. handle stderr", we'll end up with a system tailored for Unix. I'd
  88. rather pose the question like: what about other I/O streams than
  89. standard input and standard output. Other opsys'es (e.g. like VMS)
  90. have more I/O streams, even more than Unix' three.
  91.  
  92. > I don't like the ">LIFO" syntax because that conflicts with a
  93. > valid file-redirection spec, using up potential file names in
  94. > a magic-cookie sort of way. 
  95.  
  96. I don't like it either, but for another reason. It might fool users
  97. who know about redirection into believing that this is some sort of
  98. redirection.  If someone has a better notation for it, please tell me!
  99.  
  100. >                              Also, this and the piping and popen
  101. > solutions are too Unix-oriented in coding style; the programming
  102. > interface to get at the data should be in the REXX culture, not
  103. > the culture of the surrounding OS.  This would also get around
  104. > the "address something-other-than-the-native-shell" problem
  105. > you alluded to with the 'address ftp; "ls | rxqueue"' difficulty.
  106.  
  107. Yes!!! Exactly!
  108.  
  109. However, there _are_ no REXX culture on how to 'move' information from
  110. the outer environment into the rexx interpreter. TRL avoids the
  111. problem, assuming that the environment itself knows how to put things
  112. on the stack, or otherwise communicate with the interpreter. There is
  113. an IBM culture that use the stack heavily, and there are non-IBM
  114. cultures that use linein/lineout/etc heavily. But there is no One Way. 
  115.  
  116. > [speculation on how to implement deleted]
  117.  
  118. Shall we start by trying to find a good syntax? Intuitive, clear,
  119. userfriendly (yuk, that's a buzz-word!), conceptual clean, etc, etc?
  120.  
  121. > >A better solution might be to label the _methods_ rather than the
  122. > >_interpreters_, then it would be possible to check whether an
  123. > >interpreter supports e.g. the popen-based method. Then the user don't
  124. > >have to update his rexxscripts to support new interpreters, but new
  125. > >interpreters will support the already existing methods.
  126.  
  127. > No, a better solution would be to have one method.  Dispatching on
  128. > whether a particular syntax is used is just as bad as, and possibly
  129. > worse than, dispatching on a particular implememntation.
  130.  
  131. I don't feel convinced that we will find One method. At best, we might
  132. arm a function with enough parameters and options to cover all
  133. situations. But I don't think a battleship-sized function would be the
  134. best solution.
  135.  
  136. -anders
  137.