-
Notifications
You must be signed in to change notification settings - Fork 0
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
Consider using a string as the path type #2
Comments
A It also makes the API more flexible to internal changes – right now we use a list of strings but in the future we may use just a single string, for example. That can be introduced as a patch change without affecting the public API in a way that is not possible if we simply expose a type alias.
For those heavily invested in FFI-ing a particular library or API they can simply use that instead of this package. For everyone else, we think it's of greater benefit to have a standard target-agnostic
I'd actually argue that concealing implementation details can make these things easier to understand by limiting and defining the scope of the type/module. It makes consuming the code easier because the types guarantee that things are valid. |
This is true but the abstraction offered by this library does not offer better guarentees of correctness than the String type does. It does not check that the path is correct in the constructor, and the underlying This could be fixed but it would be a large amount of work and I don't believe it will result in a better UX. assert Ok(path) = path.parse(input_path)
assert Ok(str) = path.join("wibble") |> path.to_string
assert Ok(txt) = file.read(str) vs assert Ok(txt) = input_path |> path.join("wibble") |> file.read An API like this could be more accurate than one that uses a string, but I'm not convinced that wouldn't correctness at the expense of usefulness. |
how so? not convinced there's anything a |
Neither |
now that's actually a good point, Rust uses |
Hello!
Currently this library represents paths as a 2 variant custom type that each hold a list of strings. I think it would be advantageous to instead use a string:
Thanks,
Louis
The text was updated successfully, but these errors were encountered: