-
Notifications
You must be signed in to change notification settings - Fork 476
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
makes slash operator default lhs value to an empty string #1320
Conversation
Hey, @casey. Anything I am missing or should do to make this ready for review? |
Sorry for the delay! I was out of town for the weekend, and just now catching up to my GitHub notifications. Thanks for taking this on! I left some comments on the code. The I'd also like to see a few more tests. For example, in what context could the |
Thanks for the feedback! I'll take a look tonight. |
I went on quite the journey trying to make
The number of places to make the change wasn't so much a problem (tho a bit messy, I think) but the real issue was that I hit a snag with lifetimes on a borrow in So I came back around full circle, except without the potentially breaking |
How about this:
Variables is an iterator that must return all variables (and thus traverse all sub-expressions) in an expression. If |
Okay, your suggestion for variables makes sense. I have an another branch locally with those changes, so I can give that a shot and see if that was truly the last compiler error for the option approach. The question, then, is do you prefer the |
I like handling the |
Added some more comments. Also, some tests using prefix |
I added tests for when lhs is |
src/string_kind.rs
Outdated
@@ -7,7 +7,7 @@ pub(crate) struct StringKind { | |||
} | |||
|
|||
#[derive(Debug, PartialEq, Clone, Copy, Ord, PartialOrd, Eq)] | |||
enum StringDelimiter { | |||
pub(crate) enum StringDelimiter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can pub(crate)
be removed now?
These look good! And the PR looks good too, I think just a couple of pub(crate)s that aren't necessary. It's really interesting that now I'm not sure if that should be valid syntax, the thought being that maybe in the future, we want to use If, god forbid, I ever have to implement support for arithmetic in Just, then it would be pretty natural to use What do you think? Either way, let's not hold this PR up. Even if we decide to make |
That's a good question... TL;DR: I think Without having very intimate knowledge of Just's internals, here are a few ideas for arithmetic:
I am a less in favour of using Now, that doesn't answer you main question, but I think it might be enough to consider reserving |
That all sounds pretty reasonable. Also, if we have arithmetic, we'll also have static typing, so that could be used to disambiguate joins from division. I just merged master into this branch, and assuming the tests pass, is this ready to merge? |
Yes, it is! Appreciate all the feedback and patience. |
Sorry for the delay! Just added some docs. Thanks for sticking with this, this is a nice improvement. |
I was looking for a good first issue and came across #1298
The change is that the parser will now default an empty string literal on the left hand side of the/
operator if it fails unwrapping a value for the lhs. This makes it possible to create a path with an expression like:/ "Users" / user
.Lemme know if there is anything that should be changed!Edit:
The approach was changed to wrapping the left-hand side (lhs) value of a join expression (using the
/
operator) to anOption
.