Richard Hainsworth wrote:
Would it be possible to remove the special purpose of \ from strings
within IO constructs?
This would mean '\' could be used in naming paths as an alternative to
'/', thus allowing windows and unix strings to be equivalent, eg.
IO(:path<<{$root-path}/data/new>>) would be equivalent to
IO(:path<<{$root-path}\data\new>>)
The usefulness would be most evident for sub-directories as windows and
unix have different ways of describing root, viz. 'C:\' versus '/'
I see problems with this considering that \ is quite universally recognized in
Perl (and many other languages) as meaning an escape character, and that
moreover you generally need to be able to escape characters in any context
building a string.
Considering that, AFAIK, practically any modern file system, including those
used by Windows like NTFS, are Unicode savvy and can have any character in a
file name, if \ is used literally to denote itself, then what is a simple clean
way to denote other characters that would otherwise be denoted with an escape
sequence?
I think it would be best, as well as preserving the principle of least surprise,
if all of the same escaping syntaxes work universally across
character-string-like contexts, which means that a literal \ means escaping.
The best compromise that I see is that Windows filenames can be spelled out as
Windows people are used to, except that / is used instead of \, so for example a
Windows path begins with 'C:/' for example.
Or even if the '/' paradigm for root is used in Windows, which may actually be
best, the drive letter or drive name still needs to be in the path somewhere so
that multiple drives can be distinguished, for example, 'C:\' becomes '/C/'.
Under Mac OS X, all drives, root or otherwise, are accessible under
'/Volumes/<drive-name>/...', and Unix in general lets you mount drives anywhere.
I imagine Windows supports more ways of denoting drives than the drive letter,
but either way I don't see a problem here.
-- Darren Duncan