We could preserve the type-level distinction between Path and RelPath, as well as the nice superficial syntax and API. But there are things in nio.file.Path that I want:
This would be a non-trivial philosophical change that would change Paths from a transparent struct into an opaque type. Or at very least contain a pointer to an opaque type, the java.nio.file.FileSystem.
In general, the variables holding the Root and Filesystem have to live on the paths if we want to be able to perform operations that span multiple Roots or Filesystems, which we probably do. In the simplest case, Windows users would need to move files between drives.
This is impossible if you store the Root and Filesystem anywhere else, e.g. on the operations (e.g. D_drive.cp, C_drive.rm) because you won't be able to refer to paths on multiple drives in one operation.
This would also make it more awkward to use (abuse?) Path and RelPath for other non-filesystem usages. That could be considered a good thing. I've done this and it always proves to be confusing. Better to define a separate non-ammonite Path and have the types keep you straight
We could preserve the type-level distinction between
PathandRelPath, as well as the nice superficial syntax and API. But there are things innio.file.Paththat I want:This would be a non-trivial philosophical change that would change
Paths from a transparent struct into an opaque type. Or at very least contain a pointer to an opaque type, thejava.nio.file.FileSystem.In general, the variables holding the
RootandFilesystemhave to live on the paths if we want to be able to perform operations that span multipleRoots orFilesystems, which we probably do. In the simplest case, Windows users would need to move files between drives.This is impossible if you store the
RootandFilesystemanywhere else, e.g. on the operations (e.g.D_drive.cp,C_drive.rm) because you won't be able to refer to paths on multiple drives in one operation.This would also make it more awkward to use (abuse?)
PathandRelPathfor other non-filesystem usages. That could be considered a good thing. I've done this and it always proves to be confusing. Better to define a separate non-ammonitePathand have the types keep you straight