Skip to content
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

Migrate to bison parser #2185

Merged
merged 17 commits into from Jan 18, 2021
Merged

Migrate to bison parser #2185

merged 17 commits into from Jan 18, 2021

Conversation

LaPeste
Copy link
Contributor

@LaPeste LaPeste commented Jan 14, 2021

TODO

  • Changelog entry
  • Tests (if applicable)

wrappers/src/results_cs.cpp Outdated Show resolved Hide resolved
wrappers/src/results_cs.cpp Outdated Show resolved Hide resolved
wrappers/src/results_cs.cpp Outdated Show resolved Hide resolved
wrappers/src/results_cs.cpp Outdated Show resolved Hide resolved
@nirinchev nirinchev changed the title Ac/update to bison parser Migrate to bison parser Jan 14, 2021
@nirinchev
Copy link
Member

Needs a changelog entry and I asked @jedelbo to double check the C++ code in case we're missing something about the new API.

wrappers/src/results_cs.cpp Outdated Show resolved Hide resolved
@LaPeste LaPeste requested a review from jedelbo January 14, 2021 13:41
Tests/Realm.Tests/Database/CollectionTests.cs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
DescriptorOrdering ordering;
query_builder::apply_ordering(ordering, query.get_table(), result.ordering);
return new Results(realm, std::move(query), std::move(ordering));
return new Results(realm, results.get_query().and_query(std::move(parsed_query)), new_order);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::move(new_order)?

Copy link
Contributor Author

@LaPeste LaPeste Jan 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, to be honest. I noticed that as well but @ironage didn't use it in the example. I thought it was a stylistic error, but then I went to check and only Query has a custom move constructor, while DescriptorOrdering has only the default one. After seeing that I thought that it was not a mistake but a wanted choice.
What is your opinion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know - I'm not a C++ dev 😄 As mentioned, I always add std::move when I want to move something, just to be on the safe side. Maybe @ironage can educate us on the pros/cons of std::move-ing the ordering?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That feedback would be very welcome. 🙂

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you can move the ordering, I just forgot. Either way is functionally correct, but moving it is an efficient transfer of ownership, while not moving it invokes the copy constructor which inefficiently makes copies of all the contents into the new object only to then discard the previous object entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only doubt was coming from the fact that while brushing on std::move I read that returning automatic local variables generally (not sure if always) uses the move semantics instead of the copy ones, as long as a move constructor and assignment exist. So I was not sure if stylistically people still added a std::move on the returned values. You clearly answered that people generally prefer to be explicit, thank you for the feedback.

Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, hit approve too fast - still needs a user-facing changelog entry.

Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final nit from me. Otherwise, should be ready to merge once realm/realm-core#4290 goes in.

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Nikola Irinchev <irinchev@me.com>
@LaPeste LaPeste marked this pull request as ready for review January 15, 2021 17:05
@LaPeste LaPeste merged commit 13046f7 into master Jan 18, 2021
@LaPeste LaPeste deleted the ac/update-to-bison-parser branch January 18, 2021 11:58
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants