-
Notifications
You must be signed in to change notification settings - Fork 5
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
Forward declarations are incomplete entities and we should skip them. #6
Forward declarations are incomplete entities and we should skip them. #6
Conversation
No: opaque handles should be supported, eg. for GUI libraries and GPUs. |
Then in that case we enter in a grey area. What should an interface such as IsAbstract return for an incomplete class? |
I don't have a good answer for that (other then that all property queries could return yes/no/maybe), but it's not relevant in the cppyy implementation as the |
In that case could you help narrow which operations in that code need to be wrapped in IsComplete and which should be left out to make the opaque entities still work? |
I think to get the right semantics, this ordering could be changed:
For the other uses that I see, the two mean the same thing. Perhaps an alternate API could be |
50812f4
to
4e3ad10
Compare
I am not sure, but we might get away with an interface like: GetAllConstructors and insert the hooks. Then the rest should go on demand, we shouldn't require I have added some changes which partially capture our discussion here. Can you take a look? |
7bf461a
to
0cd1046
Compare
no, as said, we also need the reasons for why there may not be constructors to generate clear error messages. E.g. an abstract class can be used in inheritance, but the derived class may still be abstract if some pure virtual method was missed. An incomplete class can not be used like that at all. |
Yes, but that would be reflection information on the whole class rather than collecting all members. I am suggesting that |
4620d0c
to
4bf5fa1
Compare
@wlav, could you take a look if I am doing something crazy here. I'd like to merge this PR with the hope it will make it upstream. |
There's a whole bunch of things mixed together in here, which I'd rather see disentangled (and I'm about to cut a release, so it'll have to wait a week anyway). I'm not touching CI at this point, as I'm getting a contribution (starting with cppyy-backend) to get this done and the CI will be a build for the various pythons on various platforms, followed by an upload to PyPI, so something very different from what you have here. I'm not understanding the changes from I'm also not understanding the other renaming and API change. That definitely needs to wait for after the release, as it introduces incompatibilities that aren't easy to handle with |
Indeed, I can open a few other PRs, however the commits seem pretty disentangled.
I agree, let's see what you will get out of that.
Throughout the codebase we've seen that If we take a step back, we should probably have some strong typing for
Which change renamed an API? |
(Aside,
|
Hm... ok. The changes that are here seem not to fall into this category as we had interfaces saying
I don't think we need to. There are certain operations that can be performed on Decls and other on Types. We have interface
Ah, yes, the new design uses the opaque handles so I was not suggesting to merge that in upstream before the release. It was more towards getting your opinion if that's mergeable upstream at all or what could have made it mergeable. These changes are needed for us to make progress with the tests. |
I like that. :) Then either inheritance or custom cast operators to go between the two and in particular, we should only ever need to go from type to scope, with scope to type (likely?) to be an error. |
However, that's a major undertaking - maybe good for gsoc... |
I don't think so. :) And there seems to be a real benefit there to prevent crashes.
No? Seems simple enough and seems less work to get it right from the start then try to recover later from changes such as the one proposed where a scope is now accepted that should ever only be a type? |
Yes, that might work, @sudo-panda was looking into updating these and that might be a good way forward. However, I wanted to look into better ways to strong typing as used here: |
When we have a forward declaration this means that the entity is opaque to the compiler. Asking further details generally should work, however, there is a lot of gray zones. For example, if we ask if a forward declared entity is abstract, there is no yes/no answer. The C++ type system has the notion of complete/incomplete types where we can do our best with the little information we have. This patch introduces this into the way we generate proxy calls for the C++ enities. This needs quite a bit more refactoring.
3f58da9
to
7b46ae9
Compare
I'd like to merge this PR. Let's move this discussion here: #8 |
The work on the InterOp library has shown that we try to build proxy classes for entities which are only forward declared which leads to crashes. This patch tries to protect against these cases by saving some work and exiting early.
@wlav, can you take a look? This change is perhaps useful upstream.