[swift-evolution] Open Issues Affecting Standard Library API Stability

Dave Abrahams dabrahams at apple.com
Wed Jul 6 18:57:50 CDT 2016


on Wed Jul 06 2016, Jacob Bandes-Storch <jtbandes-AT-gmail.com> wrote:

> On Tue, Jul 5, 2016 at 10:50 PM, Dmitri Gribenko via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>>
>> > Remove unsafeAddressOf. We are not aware of any real usecases for it. If
>> there are any, it should be renamed to unsafeAddress(of:) to follow the
>> guidelines.
>> Obvious, unless someone comes up with use cases during the review period.
>>
>>
> It's minor, but I use unsafeAddressOf regularly for writing `description`
> methods:
>
>     var description: String {
>         return "<\(self.dynamicType): \(unsafeAddressOf(self))>{ more info
> here... }"
>     }

You can do that, but there's no guarantee that the address is
meaningful.  The compiler is free to copy self into a writeback buffer
whose address gets printed.

> I guess this would be covered by some generalized solution for format
> specifiers in string interpolations, but I gather that won't happen for
> quite a while...

-- 
Dave


More information about the swift-evolution mailing list