Closed yoshuawuyts closed 2 months ago
That all makes sense to me and seems like a useful addition to the overall semver workflow we started with @since
and @unstable
.
One question: it seems like, to get the full effect, we'd want wit-bindgen to be able to add whatever "deprecated" annotation to the generated function signatures which suggests that wit-bindgen would need access to the custom section into which these gates are encoded. Just to confirm, does wit-bindgen already have this on hand or would it make sense to plumb it in? It seems like we'd also need custom sections for doc-comments, so I'd assume 'yes', but I thought I'd check.
We should indeed already support this. I remember checking with Alex on this a while back and he explained that it was already possible to round-trip WIT files with gates on them when encoding them to Wasm and back. Though I haven't tested this myself yet.
Motivation
Following up on the conversation in https://github.com/WebAssembly/wasi-http/issues/107 (renaming
field-key
tofield-name
), we should support some form of@deprecated
notation to mark individual items as deprecated. In the linked issue I proposed the following flow for that:Feature design
Just like
@since
and@unstable
, it would make sense to add a third gate:@deprecated
. I think it would make sense for this feature to also carry aversion =
field (just like@since
) to mark when in which version it was deprecated. As well as some way to provide a message why this API was deprecated. I'm suggesting we use themessage =
field name for that.This matches Rust's approach fairly closely, which has a
#[deprecated(since="", note="")]
notation. Swift is a little fancier, and has an@available
notation which supports a number of configurations. What we're proposing here would in Swift be written as@available(*, deprecated, message: "")
. Swift also supports arename
field which exists specifically to point to other symbols. But unless we have an existing path notation for it, I'm hesitant to propose we add it straight away.Put together I'm proposing we should change WIT's feature gate notation to the following:
cc/ @lukewagner I'd be keen to get your thoughts on this - anything this might be missing, or you think we should do differently?