-
Notifications
You must be signed in to change notification settings - Fork 12
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
Help in handling weird join behavior #12
Comments
I think a really simple solution is to simply strip the Maybe the reason is because stripping a prefix is much less clear. Joining |
The simplest thing would be to just do what the user told you to: |
I think |
Ammonite Ops gets a lot of things right (ignore the DSL stuff). |
The issue is that I don't think I can define How do I get the following to work _without accepting either
Or are you saying that there should be runtime errors when attempting to create |
Alternative: there could be So
|
This would technically be a breaking change though :( Oh well, very few ppl are probably using |
I'm not sure I have fully understood this specific issue. Basically the argument of Whether supporting conversions from types which don't make that distinction makes sense ... I think it would be necessary to write more example code, or look at existing projects to figure out whether the convenience is worth it. My current impression is that Rust's |
what is your opinion of |
I think this is a good case for not accepting raw strings, and having different Also, I think it makes sense to only accept a single format for paths at this level, and sort out the given string means only at the last possible point, when passing things to native APIs. |
But |
Mhh, I don't have an opinion on that; my position is that Rust's macros are rather terrible from a cost/benefit point of view and hope that they get fixed. So I'm avoiding introducing new ones myself. |
Okay, I'm not totally sure on this issue. I'm very tempted to just join it as the user requests and then validate that it is a "valid" path by not allowing root or prefixes to be in the middle and returning an error if they are.
This already returns a Adding a |
The point of the standard library's behavior is that Use cases of this are all over the place in CLI args and config files, but here's one you might be familiar with: # semantics of CARGO_MANIFEST_DIR.join(path)
[dependencies]
a-local-dep = { path = "my/local-dep" } # relative to Cargo.toml
another-dep = { path = "/home/lampam/rust/another-dep" } # absolute Before it was added to |
The next version includes the |
@ExpHP thanks for explaining the logic, that is actually really helpful! I might open a PR to add that reasoning to the |
@soc left a comment here and I wrote a quick script to demonstrate the problem:
This is indeed bizare and an issue I think
path_abs
might be able to help with.The issue with "joining not compiling" is that the API for most path operations takes in
AsRef<Path>
. I think you would agree that bothRelativePath
andAbsolutePath
should beAsRef<Path>
, right? This makes the issue harder as I'm not sure of a way to disallow a certain type in rust (please let me know if there is a way).The text was updated successfully, but these errors were encountered: