Phlip
7/28/2008 11:35:00 AM
Bill Walton wrote:
>> That would be safer if fname were a Pathname.
>
> Not sure what you mean here by 'safer'. Say more?
At work we just finished a rewrite of a system that generously manipulated
folders, paths, and files. The old system originally used only strings, and
string surgery, to manipulate paths. (The old system was also very shabby and
patched up; it started as a one-shot script with no structure, etc.)
In the new system we follow a simple rule: If it's a filename, relative path, or
absolute path of any kind, it's a Pathname. This allows us to stay within the
Pathname feature set, and manipulate paths without any string surgery. The
result is much more typesafe.
In theory, Pathnames would be safer if you needed to support \ path delimiters,
and if you needed to support paths with embedded \ or / characters. We are very
good string surgeons, so we never had those problems.
--
Phlip