On Wed, Apr 5, 2000,  <[EMAIL PROTECTED]> wrote:

>Request for Comments on Split-Path Revision
>-------------------------------------------
>
>Issue: Should split-path be changed?
>
>Discussion:
>
>Split-path currently returns the last element of a path, regardless of
whether
>it is a file or directory.  That is:
>
>>> split-path %a/b/c
>== [%a/b/ %c]
>
>>> split-path %a/b/c/
>== [%a/b/ %c/]
>
>This allows writing iterative code like:
>
>>> path: %/a/b/c/d
>== %/a/b/c/d
>>> while [path <> %/] [set [path file] split-path path print file]
>d
>c/
>b/
>a/
>
>(Note, this example also shows another problem with split-path... in that it
>has no regular iterative termination condition.  If you provided a path of
>%a/b/c/d this code would loop forever, because the path would reduce to
%./ not
>%/ )
>
>However, you would normally think that a split path type of function would
>separate the directory path from the file name itself.  This would take
%a/b/c/
>and return a directory path of %a/b/c/ and a file of none (not a file of %"",
>which is a file with no name).  However, you loose the iterative "peeling"
>shown above.
>
>Since split-path has other issues that we will be fixing very soon, I would
>like to get your comments on this issue soon.  Do not consider legacy with
>existing code base.  It is better to correct this problem today, rather than
>when the child is 20.

   Isn't this a good case for refinements? While, I'm not sure what the
best default behavior should be, split-path/file and split-path/dir
refinements seem like reasonable extensions to add.

.:Eric
Sneak a peek...
http://www.smallandmighty.com/reblog/

Reply via email to