<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Typed Arrays have no public facing API"
   href="https://bugs.webkit.org/show_bug.cgi?id=120112#c36">Comment # 36</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Typed Arrays have no public facing API"
   href="https://bugs.webkit.org/show_bug.cgi?id=120112">bug 120112</a>
              from <span class="vcard"><a class="email" href="mailto:ggaren&#64;apple.com" title="Geoffrey Garen &lt;ggaren&#64;apple.com&gt;"> <span class="fn">Geoffrey Garen</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=120112#c35">comment #35</a>)
<span class="quote">&gt; &gt; We say &quot;Create&quot; or &quot;Copy&quot; when we make something that needs a release. Here
&gt; &gt; I would use &quot;Copy&quot; I guess.
&gt; 
&gt; Right, but &quot;JSObjectCopyTypedArrayData&quot; would be misleading, in that it
&gt; implies you get a copy of the data and modifying the data wouldn't do
&gt; anything on the Typed Array from where it was copied.</span >

Since the type name is &quot;TypedArrayDataPtr&quot;, you would say &quot;JSObjectCopyTypedArrayDataPtr&quot;. So, the function would claim to copy the pointer, not the underlying data. Since the pointer is a reference-counted object, it's reasonable to copy it.

<span class="quote">&gt; Maybe it should be
&gt; named JSDataWrapper instead: i.e. JSObjectCopyTypedArrayDataWrapper()!? I'm
&gt; not really fan of the verbosity, though.</span >

I wouldn't use &quot;Wrapper&quot; because the other API names don't use it, and it's less specific than &quot;data pointer&quot;.

<span class="quote">&gt; a) JSObjectGetTypedArrayData() returns a JSDataRef unretained. If you want
&gt; to hold on to it, you have to retain it yourself. I'm not sure if this is
&gt; feasible - the JSDataRef would have to last as least until the scope of the
&gt; function that called JSObjectGetTypedArrayData exits.</span >

It's impossible to return a reference counted object unretained. By definition, that's a pointer to freed memory (or leaked memory, depending on how you design things).

<span class="quote">&gt; b) We name the function in a way that doesn't follow the create/copy
&gt; nomenclature, but clearly states that you own the JSDataRef. I'd propose
&gt; JSObjectGetRetainedTypedArrayData() or JSObjectGetTypedArrayDataRetain().</span >

Maybe JSObjectRetainTypedArrayDataPtr(). (Retain functions return their targets.)

I think the copy name is better because it is more idiomatic.

<span class="quote">&gt; If it's possible in a sane matter, I think a) is preferable. Can anybody
&gt; confirm if this would be feasible? Does JSC implement something like objc's
&gt; autorelease?</span >

No autorelease. Only GC and reference counting.

You could make the data pointer a GC object. I don't think that changes things much, though.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>