<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 25, 2015, at 12:29 PM, Árpád Goretity &lt;<a href="mailto:arpad.goretity@gmail.com" class="">arpad.goretity@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">&gt;&nbsp;<span style="font-size: 12.8px;" class="">ObjC bridging means that an array might really be an opaque NSArray subclass we can't get a buffer from</span><div class=""><span style="font-size: 12.8px;" class=""><br class=""></span></div><div class=""><span style="font-size: 12.8px;" class="">Ah, I totally forgot about that. (not trying to be a pain, but NSArray could as well expose its buffer… if and only if the subclass in use doesn't do the usual circular buffer optimization. But then again, I see why this is difficult, so let's just leave it there.)</span></div></div></div></blockquote><div><br class=""></div><div>The default NS/CFArray implementation does provide internal interfaces to get at its buffer which we take advantage of. In general, though, an NSArray subclass doesn't need to offer anything more than `objectAtIndex:` and `count`, so we have to be able to deal with a potentially fully opaque interface.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class=""><div class=""><span style="font-size: 12.8px;" class="">&gt;&nbsp;</span><span style="font-size: 12.8px;" class="">By fencing the pointer's validity to a particular scope we can also keep array value semantics safe</span></div><div class=""><span style="font-size: 12.8px;" class=""><br class=""></span></div><div class=""><span style="font-size: 12.8px;" class="">Sure thing. So does this then mean that the kind of "unsafe/real address-of" operation can't be generally realized?</span></div></div></div></div></blockquote></div><div><br class=""></div><div>It might be possible, but the interactions between pointer-level and high-level accesses would get pretty complex. After a certain point of pointer and lifetime complexity, the high level semantics are just getting in your way IMO, and malloc/free start to be more appealing.</div><div><br class=""></div><div>-Joe</div><br class=""></body></html>