IntrepidPursuits / swift-wisdom

A collection of additions to the Swift Standard Library created by Intrepid Pursuits developers
MIT License
39 stars 14 forks source link

Async #58

Closed alexpersian closed 8 years ago

alexpersian commented 8 years ago

Migrate the Async module to Swift 3.

alexpersian commented 8 years ago

Complete

brightredchilli commented 8 years ago

@alexpersian I'm actually not sure if we're done here yet - I think we need to re-review each module much more closely.

For example: public func ip_locked(closure: () throws -> Void) rethrows

should at least be:

public func locked(_ closure: () throws -> Void) rethrows { ... }

// usage: NSLock.locked { ... }

or possibly

public func andDo(_ closure: () throws -> Void) rethrows {}

// usage: NSLock().andDo { ... }

I think dropping ip_ is the right thing to do, but lets have the conversation - are there any other of the apis that could be 'swiftified'? RepeatAtInterval might be suitable for conversion as well.

But what you did so far is definitely a step in the right direction!

alexpersian commented 8 years ago

Sure thing!

There were a couple of places, like RepeatAfter, where the API could be refined, but I wasn't sure if it was worth making that breaking change when the _ gives a similar reading flow. Although there will be other breaking changes, so maybe it's not a big deal.

Regarding the ip_ prefix: as far as I know extensions and protocols can still experience naming conflicts unless prefixed. I would love to be proven wrong though so it could be dropped.

(I took a look through earlier when @paulrolfe brought this up and didn't notice any ip_ outside of extensions/protocols)

alexpersian commented 8 years ago

Closing this issue out after a discussion with @brightredchilli. After tests for Async are converted then the naming can be looked at again to see if it can be refined.