New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change `Path` into a wrapper around `java.nio.file.Path`? #346

Closed
lihaoyi opened this Issue Feb 17, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@lihaoyi
Owner

lihaoyi commented Feb 17, 2016

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

@lihaoyi

This comment has been minimized.

Owner

lihaoyi commented Feb 18, 2016

This has happened in master and will go out 0.6.0

@lihaoyi lihaoyi closed this Feb 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment