On Thu, Jun 26, 2008 at 7:55 AM, Bill Turner, WB4ALM <[EMAIL PROTECTED]> wrote:
> Mark, I am relatively new to the world of unix (more later)
> but I think that your statement:
>
> "My theory is that: before trying to search for a program file by
> artificially adding an extension, you should try the file name as
> given."
>
> is a perfectly valid consideration - and is my preference.

Bill, glad to see some people are following these discussions.  Rick's
arguments swayed me though.

Take the following, rather contrived example.  I used to write large
Rexx applications where I had a number of functions that were called a
lot and placed in individual program files.  Then I called them as a
function.  I would put them all in one directory and place that
directory first in the path.

Whether that is a good or silly way to use Rexx, I'm not going to
debate. <grin>  But, from the discussion lists I know that other
people do similar things.

So in the listing below, the prog.rex program calls the program file
dir.rex as a function.  It gets a directory listing and then displays
only the first 11 lines.

The search we have been talking about is how the interpreter locates
the external routine dir().  More specifically, should it first search
for a file in the path with the name of "dir" exactly, or should it
first search for dir.rex.

One of Rick's arguments is that on Linux you have binaries without an
extension and if you search for dir first, you pick up the binary.
(Because it is in the path.)  When the user really wants dir.rex and
has used the extension to be sure it is not confused with the binary
of the same name.

My argument, the one where I agreed with Rick, is that I always put
the extension on.  So, I want the search to be for dir.rex first,
simply because I don't want the search to waste time looking for just
dir.  (I always put the extension on the files because I want to be
able to recognize my Rexx programs and I always use the syntax of
'dir'() rather than 'dir.rex'() because it is prettier.)

Well here is the listing, it got shoved pretty far down:

/* prog.rex */

  listing = 'dir'()

  counter = 0
  do line over listing
    if counter > 10 then leave
    say line
    counter += 1
  end

/* dir.rex */

  tempFile = "delete.me"

  'dir >' tempFile '2>&1'

  fileObj = .stream~new(tempFile)
  listing =  fileObj~arrayin

  fileObj~close
  'del' tempFile '> nul 2>&1'

  return listing

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to