I like this way.
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 '/'
David Green wrote:
We should start thinking about the fundamental objects for doing IO as
IO-objects. They *have* names, but they aren't names, or strings, or
even filehandles (although they might *have* filehandles encapsulated
inside to do the actual work). A filename is merely a way to get at
the actual object, just as the string "2009/1/1" can be used to get a
Date object. A string, or a handle, or an inode, or some unique
filesystem spec number, or anything else you can get your hands on
should be fed to a constructor:
Of course, this being P6, we can have some kind of "io" macro that
parses the single item after it:
my $file1 = io file://some/dir/some%20file; #
the quick way
my $file2 = IO.new(:protocol<file> :uri<foo/bar/a file.html>); #
the verbose way