Isn't every use of "Pointer" in the standard library prefixed by "Unsafe"? If so, we'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 <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div>>> <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't that just a pointer? Is it really necessary to say "unsafe" and "pointer"?</span></div><div><span><br></span></div><div><span>And if we did want to make it explicit, perhaps we say "unowned" instead, to make it clear how it is unsafe. "</span><span style="background-color:rgba(255,255,255,0)">RawBufferPointer</span><span>"/"UnownedRawBufferPointer" 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:'Helvetica Neue','Helvetica',Helvetica,Arial,sans-serif;font:'-apple-system-body'"><br></div></div><div style="font-family:'Helvetica Neue','Helvetica',Helvetica,Arial,sans-serif;font:'-apple-system-body'">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, <<a href="mailto:atrick@apple.com" target="_blank">Andrew Trick</a>> wrote:<br><br></div><div><br><div><blockquote type="cite"><div>On Sep 2, 2016, at 7:36 PM, Karl via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> 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"?</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>