Giter VIP home page Giter VIP logo

Comments (6)

tjarratt avatar tjarratt commented on August 17, 2024

Thanks for opening this issue @codeman9 -- I hadn't been aware of this breakage in the betas.

I don't have an answer to this issue right now -- it looks like we'll need to either investigate moving this over to ARC (which may be very hard to get right), or find another way of creating a weak reference. It's a little frustrating that Apple seems to be implying that weak references never worked outside of ARC, because I'm fairly certain I've actually seen __weak resolve retain cycles when ARC wasn't being used. Maybe I'm wrong.

from cedar.

briancroom avatar briancroom commented on August 17, 2024

My understanding of these statements is that the __weak attribute never actually did anything in MRC, which isn't surprising to me at all. In MRC all references are effectively weak anyway, it just means that the auto-zeroing behavior wasn't available unless you called down to objc_storeWeak and objc_loadWeak yourself, which is what Cedar is doing here.

I've pushed 9ab7ca0 which seems to resolve the issue by just removing the annotation. The variable names still contain the word weak so the intention is still reasonably documented. @codeman9 could you check and see if this works on your end?

from cedar.

akitchen avatar akitchen commented on August 17, 2024

Under MRC references are assign, not weak -- an important difference if
relying on the value of the pointer (null/not null). An assign reference
can be non-null, but point to garbage, whereas weak is guaranteed to be nil
or point to something valid.

I have a feeling there is reliance on this value distinction in the code
these days, so we should be careful here.

On Sun, Mar 6, 2016 at 05:26 Brian Croom [email protected] wrote:

My understanding of these statements is that the __weak attribute never
actually did anything in MRC, which isn't surprising to me at all. In MRC
all references are effectively weak anyway, it just means that the
auto-zeroing behavior wasn't available unless you called down to
objc_storeWeak and objc_loadWeak yourself, which is what Cedar is doing
here.

I've pushed 9ab7ca0
9ab7ca0
which seems to resolve the issue by just removing the annotation. The
variable names still contain the word weak so the intention is still
reasonably documented. @codeman9 https://github.com/codeman9 could you
check and see if this works on your end?


Reply to this email directly or view it on GitHub
#376 (comment).

from cedar.

briancroom avatar briancroom commented on August 17, 2024

Good call @akitchen. I think the salient point here though is that __weak under MRC has never actually provided zeroing weak references, they were still just standard assign references after all. That's why the code using these variables calls into objc_storeWeak and objc_loadWeak to manually invoke the runtime magic that provides the nil-after-dealloc behavior.

from cedar.

akitchen avatar akitchen commented on August 17, 2024

Yup, I completely agree. I think the key word here is "magic"

On Sun, Mar 6, 2016 at 07:46 Brian Croom [email protected] wrote:

Good call @akitchen https://github.com/akitchen. I think the salient
point here though is that __weak under MRC has never actually provided
zeroing weak references, they were still just standard assign references
after all. That's why the code using these variables calls into
objc_storeWeak and objc_loadWeak to manually invoke the runtime magic
that provides the nil-after-dealloc behavior.


Reply to this email directly or view it on GitHub
#376 (comment).

from cedar.

codeman9 avatar codeman9 commented on August 17, 2024

@briancroom The changes you pushed removed the errors for me. Thanks!

from cedar.

Related Issues (20)

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.