Comment

Comment by jagged-chisel

The 'proposed solution':

    extension Toaster {
      @available(toasterOS 1.0, *)
      @backDeployed(before: toasterOS 2.0)
      public func makeBatchOfToast(_ breadSlices: [BreadSlice]) -> [Toast] { ... }
    }
So it was introduced in 1.0, right? Then why do I need an annotation saying "you can use this before 2.0?" This is where I'm confused. If this example is not a mistake, the purpose of @backDeployed is not clear to me.

I would have expected `@available(toasterOS 2.0, *)` indicating this was not implemented until 2.0, followed by `@backDeployed(toasterOS 1.0` indicating it's also available to this earlier version.

Please correct me where I've gone wayward.

My proposal would be `@available(toasterOS VersionOlderThanCurrent)` indicating this is available for use in that older version, and an optional `@developedWith(toasterOS CurrentVersion)`

Edit: you say

> @available is, indeed, when something was actually introduced. As you put it, "available to use starting with this version."

Let me be clear in my intent: I read the linked article as saying @available is "I implemented this using version X", and I always thought it was "this will [only] work on version X (or later?)" regardless of when it was actually written. These have different meanings - that is my intent.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton