[Review] SE-0061: Add Generic Result and Error Handling to autoreleasepool()


(Dave Abrahams) #1

Hello Swift community,

The review of "SE-0061: Add Generic Result and Error Handling to
autoreleasepool()" begins now and runs through April 26. The proposal is
available here:

  https://github.com/apple/swift-evolution/blob/master/proposals/0061-autoreleasepool-signature.md

Reviews are an important part of the Swift evolution process. All
reviews should be sent to the swift-evolution mailing list at

  https://lists.swift.org/mailman/listinfo/swift-evolution

or, if you would like to keep your feedback private, directly to the
review manager.

What goes into a review?

The goal of the review process is to improve the proposal under review
through constructive criticism and, eventually, determine the
direction of Swift. When writing your review, here are some questions
you might want to answer in your review:

  * What is your evaluation of the proposal?

  * Is the problem being addressed significant enough to warrant a
          change to Swift?

  * Does this proposal fit well with the feel and direction of
          Swift?

  * If you have you used other languages or libraries with a
          similar feature, how do you feel that this proposal compares
          to those?

  * How much effort did you put into your review? A glance, a
          quick reading, or an in-depth study?

More information about the Swift evolution process is available at

  https://github.com/apple/swift-evolution/blob/master/process.md

Thank you,

-Dave Abrahams
Review Manager


(Jacob Bandes-Storch) #2

        * What is your evaluation of the proposal?

+1. I believe "pass-through" functions such as autoreleasepool,
withExtendedLifetime/withUnsafePointer, dispatch_sync, etc. should all have
a generic-result/rethrowing signature.

        * Is the problem being addressed significant enough to warrant a
          change to Swift?

Workarounds were doable, but clunky.

        * Does this proposal fit well with the feel and direction of
          Swift?

Seems so.

        * If you have you used other languages or libraries with a
          similar feature, how do you feel that this proposal compares
          to those?

N/A

        * How much effort did you put into your review? A glance, a
          quick reading, or an in-depth study?

Quick reading of the proposal, because the implementation is very simple,
and I've implemented similar utility functions before.

Jacob


(Michael Peternell) #3

Comments inline

  https://github.com/apple/swift-evolution/blob/master/proposals/0061-autoreleasepool-signature.md

  * What is your evaluation of the proposal?

A big +1 from me. It doesn't create any incompatibilities. Old code will behave the same as before. autoreleasepool works more like @autoreleasepool from Objective-C now.

  * Is the problem being addressed significant enough to warrant a
         change to Swift?

The problem is not very big, but since the change doesn't introduce any incompatibilities, I'd say: Yes

  * Does this proposal fit well with the feel and direction of
         Swift?

I think so.

  * If you have you used other languages or libraries with a
         similar feature, how do you feel that this proposal compares
         to those?

Well, Objective-C has the @autoreleasepool. I think the only reason why it is available in Swift too, is because Swift is normally used on top of the Objective-C runtime. Swift's autoreleasepool will behave more like the original @autoreleasepool if this proposal is implemented. Implementing the proposal feels more like a bugfix to me.

  * How much effort did you put into your review? A glance, a
         quick reading, or an in-depth study?

I read the proposal.

-Michael


(Ben Rimmington) #4

<https://github.com/apple/swift-evolution/blob/master/proposals/
0061-autoreleasepool-signature.md>

+1. I believe the proposal should be accepted.

However, cross-platform libraries would still need to write:

#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
    import func ObjectiveC.autoreleasepool
#else
    func autoreleasepool<Result>(
        @noescape body: () throws -> Result
    ) rethrows -> Result {
        return try body()
    }
#endif

Charles Srstka suggested an @autoreleasepool attribute:

<http://thread.gmane.org/gmane.comp.lang.swift.evolution/2796>

-- Ben


(John Lin) #5

* What is your evaluation of the proposal?

+1 for the change

* Is the problem being addressed significant enough to warrant a
change to Swift?

It’s not really a significant issue, but since nothing will be broken, it should be fine.

* Does this proposal fit well with the feel and direction of
Swift?

Yes. make autoreleasepool function-ish matches the ultimate goal of deprecating Obj-C.

* If you have you used other languages or libraries with a
similar feature, how do you feel that this proposal compares
to those?

N/A

* How much effort did you put into your review? A glance, a
quick reading, or an in-depth study?

Quick read the whole proposal.

—John