[swift-users] Retro-fitting @noescape

Jacob Bandes-Storch jtbandes at gmail.com
Thu Jan 14 02:05:01 CST 2016


You can work around this by wrapping it with a C function that uses
__attribute__((noescape)).

An example of this is in my proposal "Add @noescape to public library API":
https://github.com/apple/swift-evolution/blob/master/proposals/0012-add-noescape-to-public-library-api.md

Jacob Bandes-Storch

On Mon, Jan 11, 2016 at 6:29 AM, Daniel Eggert via swift-users <
swift-users at swift.org> wrote:

> I’m trying to wrap
>
>   public typealias dispatch_data_applier_t = (dispatch_data_t!, Int,
> UnsafePointer<Void>, Int) -> Bool
>   public func dispatch_data_apply(data: dispatch_data_t, _ applier:
> dispatch_data_applier_t) -> Bool
>
> with
>
>   func forEach(@noescape body: (UInt8) throws -> ()) rethrows
>
> but since dispatch_data_apply() promises to be @noescape (in the
> documentation), but doesn’t declare it, I’m stuck. Is there a way to tell
> the compiler: Really, this will not escape?
>
> /Daniel
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160114/6e04727d/attachment.html>


More information about the swift-users mailing list