-
Notifications
You must be signed in to change notification settings - Fork 17
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
What inplace operator should we use for path concatenation? #2
Comments
One option is |
Another option is |
A third option is |
Here is my preference: I like |
Paths are a Free Monoid, (as are strings). Another reason is we will get some juxtaposition working, ✔️ path literal then string literal will work:
✅ path literal then variable will not work, but could be made to workBut could be made to work with a change to the path macro definition.
✅ path literal then path literal will not work, but could be made to work
❌ string variable then path literal can't be made to work
❌ path variable then string literal can't be made to work
✔️ String literal then path variable will work
✔️ String literal then path literal will work
EDIT: A lot of this will not work in 1.0 as juxtraposition has been nerfed. |
My argument against just reusing Operators for path join/append in other software: |
One argument against using p"/foo/bar/baz" * ".txt" == p"/foo/bar/baz.exe" |
I'm also not sure if we want to be consistent with math conventions because different areas of mathematics use different symbols (e.g., cryptography uses |
Alright, I think it's been long enough that we should make a decision. Based on the comments and votes above I'm going to move forward with:
|
Another option is |
Syntactically that seems more confusing and the argument that we aren't doing division still holds because we also aren't creating a rational. I feel like it's fine for the operator to do different things in this context. |
I tried this in a few places and I found it uncomfortable. |
Which thing? |
Yeah, Either way though |
We do overload |
The
join
function currently is there, and I see no reason to change anything about it.But it would be nice to also have an inplace operator that does the same trick. I'll list some candidates as separate comments, so that folks can like/dislike them individually. Any reasons, explanations, new suggestions etc. would also be most welcome!
We might also look around what other languages do about this.
The text was updated successfully, but these errors were encountered: