Hi Bertram,

Yes, this looks like a bug of some sort.  The manual I have gives the
description as you quote, but then the example that follows immediately
after clearly does not expect the same behaviour.

I would say that this is a documentation bug as the documentation lists two
different behaviours which can't both be right, and the code only displays
one of these behaviours.

FWIW, I have been using this function wrongly for over a decade and for
some unfathomable reason it has not yet caused a problem.  This is probably
because I set (& then ineffectively pop) the directory wherever it is
critical.

Unless anyone has further wisdom on this one of us should raise a bug
report.

Jon

On 2 February 2016 at 21:44, Bertram Moshier <bertrammosh...@gmail.com>
wrote:

> Hi,
>
> I'm confused about the directory function both in its usage and
> documentation.
>
> The documentation reads:
>
> Returns the current directory, changing it to *newdirectory* if an
>> argument is supplied and the named directory exists. If *newdirectory* is
>> not specified, the name of the current directory is returned. Otherwise, an
>> attempt is made to change to the specified *newdirectory*. If
>> successful, the name of the *newdirectory* is returned; if an error
>> occurred, null is returned.
>>
>
> The opening sentence looks to be clear.  The directory function will:
>
>    1. Obtain the current directory and
>    2. Change to a new directory (assuming it exist).
>
> The second sentence is also clear.  If you don't include an argument,
> you'll get the name of the current directory and no attempt to change to a
> new directory will occur.
>
> What I don't understand are the last two sentences and how they relate to
> the first two sentences.  They seem in conflict.
>
> "Otherwise"  OK, otherwise to not having an argument (e.g. new directory),
> sure, it is what occurs in the opening sentence IF the directory exists.
>
>
> *All right, instead of analyzing the documentation maybe a simpler way to
> ask/say all this is:*
>
> *HOW DO I GET THE DIRECTORY FUNCTION TO OPERATE AS DESCRIBED IN THE
> OPENING SENTENCE?  The given is the directory specified by newdirectory
> does exists.*
>
>
> Basically what I would like is to code:
>
> Current_Directory = directory(New_Directory)
>
> and when New_Directory exists I get the Current Directory, if the New
> Directory doesn't exists I get null.
>
> It is how I read the opening sentence to the Directory function.
>
> What I am seeing though, is either the new directory or null and never the
> current directory, as described in the opening sentence.
>
>
>
>
> What am I trying to do is write a very simple function to:
>
>    1. State (like FSSTATE in CMS) the existence of a directory (new
>    directory).
>    2. If it exists, cool, return and depending upon arguments leave the
>    directory as either the new directory or the caller's current directory.
>    3. If it does not exist, then make the new directory, return, and like
>    #2 leave the directory per arguments.
>
>
>
> *Yes, I can code based upon the behavior I'm seeing, but I'd like to
> understand how to get Rexx to behave as described in the opening sentence,
> PLEASE and Thank You.*
>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to