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
Public Group API prepared for soon-to-arrive Group::remove_table() [BREAKS PUBLIC API] #515
Conversation
…to properly support the soon to be added Group::remove_table()
…ssues, and to properly support the soon to be added Group::remove_table()
…ssues, and to properly support the soon to be added Group::remove_table()
Conflicts: release_notes.md
Please review |
Before merging we need to discuss the integration of this in bindings. I really don't like to change the semantics of existing methods without getting some compiler assistance to detect it. I'm not aware if this has been discussed in advance of all these changes? Never the less, I've always argued for this more clear meaning of get_table and get_or_add_table.. |
I understand your concern with respect to the lack of compiler assistance. On the other hand, using If you want my help, I can general a "high fidelity" list of places where Group::get_table() is called, for Cocoa and Java, then you can consider in each case whether the right new function to call is And remember that it is always safe to substitute |
Let's consider if we need to make a "binding conversion note" |
I have prepared a PR to upgrade the Cocoa binding: realm/realm-swift#785 |
I have prepared a PR to upgrade the Java binding: realm/realm-java#324 |
I have prepared a PR to upgrade the Python binding: Tightdb/tightdb_python#196 |
Please review |
Please review |
Public Group API prepared for soon-to-arrive Group::remove_table() [BREAKS PUBLIC API]
* master: Improve the migration documentation more Fix some typos Improve the migration documentation Fix a bunch of small errors in the RLMRealm docs Improve the autorefresh documentation Don't set TIGHTDB_MAX_LIST_SIZE for debug builds Upgrade core library version 0.82.0 -> 0.82.1 Fix crash when adding an object already in a realm to another realm Update changelog Updates necessitated by change core Group API (realm/realm-core#515) Upgrade core library version 0.81.0 -> 0.82.0 Use an exception rather than assertion Check the token's block in case it was niled while being enumerated Make sure the token block is not nil Conflicts: CHANGELOG.md
The public Group API has been heavily upgraded to fix old issues, and to properly support the soon-to-be-added
Group::remove_table()
.The most important change is that
Group::get_table()
no longer creates tables that are not already in the group.Group::get_table()
will now return null if there is no table in the group with the specified name.New tables are added with one of the new functions
Group::add_table()
orGroup::get_or_add_table()
.These changes will require a careful examination and update of all our language bindings, and it is not likely that the compiler is going to help find the places where changes are needed.
A simpleminded approach to updating a language binding would be to find every occurrence of a call to
Group::get_table()
and replace it with a call toGroup::get_or_add_table()
. This will very likely work, becauseGroup::get_or_add_table()
has virtually the same meaning asGroup::get_table()
had before.Here is a detailed account of the publicly visible changes:
Group::has_table<T>()
removed, because it had awkward and incongruous semantics, and could not be efficiently implemented.Group::find_table()
added as a way of mapping a table name to the index of table in the group.Group::get_table(index)
andGroup::get_table_name()
now throwInvalidArgument
if the index is invalid.Group::get_table(name)
no longer creates a table when none exist with the specified name. Its semantics has also changed in several other ways.Group::add_table()
andGroup::get_or_add_table()
added.LangBindHelper::bind_table_ref()
toLangBindHelper::bind_table_ptr()
, andLangBindHelper::unbind_table_ref()
toLangBindHelper::unbind_table_ptr()
.LangBindHelper::get_table()
, one whose argument is a table name, and one whose argument is the group-level index. Neither one is exactly like that original version ofLangBindHelper::get_table()
.LangBindHelper::add_table()
andLangBindHelper::get_or_add_table()
added.WriteTransaction::add_table()
andWriteTransaction::get_or_add_table()
added.ResourceAllocError
eliminated, as there was no good reason for keeping it (it had no clear role).@finnschiermer @astigsen @rrrlasse