Comments (8)
If we forward -isKindOfClass:
One problem is that the Class
will become a remote object on the receiving side and will never succeed. We can make Class
pass-by-value, however, is there a way to know the class linked in two processes are the same if only given the name or is there any way to check class integrity/equality?
from edistantobject.
Good question. I don’t know the answer, but perhaps we can look at how Apple does it?
from edistantobject.
we can look at how Apple does it?
It is a little convoluted to digest, this is one of the sources we used to learn in the past. You are welcome to take a look and send the PR, I am happy to review.
from edistantobject.
Findings
NSDistantObject
calls-[NSConnection forwardInvocation:forProxy:]
, which calls-[NSInvocation encodeWithDistantCoder:passPointers:]
with anNSPortCoder
.- I am assuming
-[NSInvocation encodeWithCoder:]
is called after that, which encodes the arguments using the coder. - In
NSPortCoder
, the whole inheritance hierarchy is serialized. - For each class, the class name and the class version are serialized.
from edistantobject.
Great findings, thanks!
What do you think of implementing it in eDO? To encode a class
, we record the entire hierarchy and their respective versions; to decode, we find the class
name and attempt to match its local version and hierarchy, right? this sounds a reasonable start. How do you think of a coincidental client that has the same entire hierarchy but a different implementation? I think this odd is super low, but it can happen too, right?
the other question, what is class version, how do we make sure it's well maintained?
from edistantobject.
Thanks a lot for looking into this @fumoboy007. If class_getName can work across processes, then this would work for the cursory isKindOfClass comparison. My worry is how this would differ from an actual Class comparison itself.
from edistantobject.
Hmm not sure if we can really guarantee compatibility across processes. FWIW, Apple/GNUstep’s implementation just calls objc_lookUpClass
. I don’t think it even checks the version or the hierarchy. If y’all are comfortable with doing that, I can implement it.
from edistantobject.
FWIW, Apple/GNUstep’s implementation just calls objc_lookUpClass.
After thinking about it, it should be fine because we are checking the class
remote with a remote object. Suppose the client fakes a class by name, it would only cause the host to look it up.
If y’all are comfortable with doing that, I can implement it.
It will be great if you can implement it. Either Aditya, me or someone from our team can review it. There are another two things you might need to take a look:
-
Class is handled differently by ARC, probably because it's
static
. you may need to pay extra attention to it. -
We have
EDO_REMOTE_CLASS
where you do need a remoteClass
, we need to make sure this behavior is not broken.
from edistantobject.
Related Issues (11)
- Support asynchronous block callback arguments in methods HOT 19
- Blocks cannot be serialized properly to remote objects due to load order bugs HOT 4
- Can eDO host & client connect on two devices? HOT 1
- NSSecureCoding instead of NSCoding HOT 1
- Face with a crash caused by [NSKeyedArchiver edo_archivedDataWithObject:] HOT 3
- Detail is slightly confusing
- A few unused-but-set-variable errors in EDO
- Error while running the tests.
- Support for Swift Package Manager
- Add better documentation for Swift integration. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edistantobject.