-
Notifications
You must be signed in to change notification settings - Fork 25
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
Organism refactor with multiple inheritance #198
base: complex-genomes
Are you sure you want to change the base?
Conversation
emp::Ptr<PGGSymbiont> sym = syms[i].DynamicCast<PGGSymbiont>(); | ||
if (sym == nullptr) { | ||
throw "Non-PGG symbiont in PGG host"; | ||
} | ||
double hostPool = sym->ProcessPool(); |
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.
This is the worst part of this change in my opinion, unfortunately I haven't really found any way to get around it without either adding stubs to BaseSymbiont (so the "Organism has every method needed by any mode" approach used before this PR) or using far too many templates. At least it makes each place where we have a requirement for a specific subclass explicit.
857fca0
to
75692b9
Compare
After an unreasonable amount of time spent debugging this, it looks like Empirical's pointer tracking infrastructure doesn't actually support inheritance correctly. It's only appearing now that the inheritance is more complex with the multiple inheritance changes, but it's not actually specific to multiple inheritance - it assumes that the address of an object doesn't change when it's casted to a base class, but that's not actually true in general. Specifically, we create a pointer to I'm not sure what the best approach to get around this is, but the easiest option would be to just give up on Empirical's pointer tracking - remove (Pointer tracking is disabled for now but a fix is hopefully on the way, see devosoft/Empirical#476 and devosoft/Empirical#477) |
- the symbiont mutations aren't 100% reproducible with the old code so I changed the random seed and test lineage slightly
- was caused by deleting the parent during Process()
- free syms aren't working properly yet though
- they compile but don't pass yet
I don't know if we actually want to go through with all of this, I'm basically trying to take it as far as I can and then we can figure out how much we want to keep. This PR also adds more
cc
files, but they're still just#include
d instead of actually being compiled separately because Empirical doesn't support that. Unfortunately, that means they have to be included in each entry point file.