Isn&#39;t every use of &quot;Pointer&quot; in the standard library prefixed by &quot;Unsafe&quot;? If so, we&#39;ll want to follow the convention here.<br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 7, 2016 at 07:48 Karl Wagner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div>&gt;&gt; <span style="background-color:rgba(255,255,255,0)">1. It points into memory that it does not own. The developer must do something to to manage the memory’s lifetime.</span></div><div><span><br></span></div></div></div><div><div><div><span>Isn&#39;t that just a pointer? Is it really necessary to say &quot;unsafe&quot; and &quot;pointer&quot;?</span></div><div><span><br></span></div><div><span>And if we did want to make it explicit, perhaps we say &quot;unowned&quot; instead, to make it clear how it is unsafe. &quot;</span><span style="background-color:rgba(255,255,255,0)">RawBufferPointer</span><span>&quot;/&quot;UnownedRawBufferPointer&quot; sound pretty good to me. You can derive some pretty solid expectations from those names.</span></div></div></div><div><div><div><div style="font-family:&#39;Helvetica Neue&#39;,&#39;Helvetica&#39;,Helvetica,Arial,sans-serif;font:&#39;-apple-system-body&#39;"><br></div></div><div style="font-family:&#39;Helvetica Neue&#39;,&#39;Helvetica&#39;,Helvetica,Arial,sans-serif;font:&#39;-apple-system-body&#39;">Karl</div></div></div><div><div><div><br><br><blockquote type="cite" style="margin:1ex 0 0 0;border-left:1px #ccc solid;padding-left:0.5ex"><div>On Sep 6, 2016 at 10:59 pm, &lt;<a href="mailto:atrick@apple.com" target="_blank">Andrew Trick</a>&gt; wrote:<br><br></div><div><br><div><blockquote type="cite"><div>On Sep 2, 2016, at 7:36 PM, Karl via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">* Does this proposal fit well with the feel and direction of Swift?<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Yes, but I’m not sure about the “Unsafe” part of “UnsafeBytes” — what is unsafe about getting the byte-representation of a value?</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">As I understand it, “Raw” is what we use for “untyped”, so might I suggest “RawBytes&quot;?</span></div></div></blockquote></div><br><div>It’s annoying, but a strict requirement in Swift that any “unsafe” operation be marked with the word “Unsafe” either at that point or in some enclosing scope. Unsafe broadly refers to various forms of memory unsafety. Unsafe bytes is actually safe with respect to pointer aliasing but it is unsafe because</div><div><br></div><div>1. It points into memory that it does not own. The developer must do something to to manage the memory’s lifetime.</div><div><br></div><div>2. It does not perform bounds-checking in release mode.</div><div><br></div><div>In both those respects, it’s just like UnsafeBufferPointer.</div><div><br></div><div>-Andy</div></div></blockquote></div></div></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>