On Fri, Apr 15, 2005 at 09:32:23PM -0400, Chip Salzenberg wrote:
> > Perl 6 is going to have to decide on some sort of standard internal getcwd 
> > technique, $CWD or not.
> 
> I don't think Perl 6 "has" to do anything of the kind.  It would
> be a mistake to try.

Sorry, I had assumed that having a "simple" cwd() was a forgone conclusion 
so I just tried to bull through it.  My bad.  Lemme back up a few steps and 
try again. [1]

Yes, there are lots of ways to check the cwd each filling in one edge
case or another.  However I'd like to believe its possible to come up with
one simple, safe cwd() that works for 99.9% of the cases and call that cwd().
Then have a Cwd module full of all the various other techniques (or perhaps
attributes to alter the behavior of cwd()).  This lets you answer the 
question "How do I get the current working directory?" with "Short answer: 
cwd().  Long answer: For this set of conditions, use this..." 
This avoids the current state of things where a user with a simple
desire must slog through the rather daunting choices provided by Cwd.pm
and probably wind up making the wrong decision. [2]  A high level language
really should smooth all that over.

How cwd() is implemented is not so important as what happens when it hits
an edge case.  So maybe we can try to come up with a best fit cwd().  I'd 
start by listing out the edge cases and what the possible behaviors are.  
Maybe we can choose a set of behaviors which is most sensible across all 
scenarios and define cwd() to act that way.  Or maybe even just define what 
various cwd variations currently do.

Here's the ones I know of off the top of my head.  You probably know more.

* The cwd is deleted
* A parent directory is renamed
* A parent directory is a symlink


[1]  http://angryflower.com/pathof.gif
[2]  The state of Cwd.pm's docs add to my anxiety.

Reply via email to