Git Product home page Git Product logo

Comments (8)

wuhao5 avatar wuhao5 commented on May 4, 2024

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.

fumoboy007 avatar fumoboy007 commented on May 4, 2024

Good question. I don’t know the answer, but perhaps we can look at how Apple does it?

from edistantobject.

wuhao5 avatar wuhao5 commented on May 4, 2024

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.

fumoboy007 avatar fumoboy007 commented on May 4, 2024

Findings

  1. NSDistantObject calls -[NSConnection forwardInvocation:forProxy:], which calls -[NSInvocation encodeWithDistantCoder:passPointers:] with an NSPortCoder.
  2. I am assuming -[NSInvocation encodeWithCoder:] is called after that, which encodes the arguments using the coder.
  3. In NSPortCoder, the whole inheritance hierarchy is serialized.
  4. For each class, the class name and the class version are serialized.

from edistantobject.

wuhao5 avatar wuhao5 commented on May 4, 2024

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.

tirodkar avatar tirodkar commented on May 4, 2024

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.

fumoboy007 avatar fumoboy007 commented on May 4, 2024

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.

wuhao5 avatar wuhao5 commented on May 4, 2024

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:

  1. Class is handled differently by ARC, probably because it's static. you may need to pay extra attention to it.

  2. We have EDO_REMOTE_CLASS where you do need a remote Class, we need to make sure this behavior is not broken.

from edistantobject.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.