[swift-evolution] [Discussion] Deprecation Linking

Brent Royal-Gordon brent at architechies.com
Tue Apr 12 02:27:04 CDT 2016


> #begindeprecation(message=“optional comment”, available=iOS 8.0)
> func fetchProjects(query query : String?) {
>    // some code
> }
> #replacement(message=“some comment”), available=iOS 9.0)
> func fetchProjects(query query : String?, scope : String?) {
>    // some code
> }
> #replacement(message=“some comment 2”, available=iOS 9.0) 
> func fetchProjects((query query : String?, scope : NSPredicate) {
> }
> #enddeprecation

Swift already offers this similar syntax (I'm using a future syntax tweak here):

	@available(iOS, unavailable, renamed: "fetchProjects(query:)")
	func fetchProjects(_ query: String?) { ... }

What if that was extended to allow it to be applied to deprecations, and to allow for differences in signature for functions?

	@available(iOS, introduced: 8.0, deprecated: 9.0, renamed: "fetchProjects(query:scope:)")
	func fetchProjects(query query: String?) { ... }

Alternatively, we could use a `replaced` keyword to distinguish between simple renames and more complicated changes.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list