-
Notifications
You must be signed in to change notification settings - Fork 75
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
Assign a table to a TableCollection #1489
Comments
Makes sense to me! |
However, since all these tables refer to each other, it doesn't seem that common that we'd actually have an IndividualTable that makes sense by itself - although I see the counter-example in #1487. Or, I could imagine a nice way to modify, say, a mutation table would be
... although, now we could do
|
I agree, we have a lot of code that does the copy-clear-mutate-add/append dance. I prefer making a new table then assigning it as in your first example. |
Sure, it makes sense. We would need to be clear that the semantics is this though:
The fact that we're not actually assigning the object itself is what put me off this in the past, as that seems a bit counter intuitive and contrary to what you might think of the semantics of assignment. The object ownership stuff holding the tables in a TableCollection is very tricky, and I definitely don't want to go messing with that. |
I guess another way of doing this would be to have a method
I'm not sure about the name, but "Replace the contents of this table with the contents of the specified table" seems like a clear definition? |
I agree that it would be better to have this be a named method, rather than doing sneaky modification on assingment. We should add a helpful message to the error on assignment that signposts the named function. How about |
Yes, that sounds good. |
If we don't just get to assign with
|
No harm in having two ways of doing it, though. It would make it more natural to pass around tables on their own. |
Presumably the more efficient way is to set the columns rather than add each row (as this doesn't check the metadata):
I think this should be fairly efficient? |
Actually, should it be as simple as this in the BaseTable class:
|
I'm reopening this as we haven't done assignment, but also haven't decided to not do it! |
Currently this results in an error:
Is there any reason that it shouldn't be possible? The implementation of this would seem to be clearing the existing table and copying the table data across.
Came up in the context of #1487 (comment)
The text was updated successfully, but these errors were encountered: