From 8c469423ab91456b37021fec401288e5607856e2 Mon Sep 17 00:00:00 2001 From: Jan Weidner Date: Mon, 6 Jan 2020 21:16:12 +0100 Subject: [PATCH 1/2] deprecate MultiPropertyLens and @settable --- src/experimental.jl | 6 ++++++ src/settable.jl | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/experimental.jl b/src/experimental.jl index 46a792c..11102e1 100644 --- a/src/experimental.jl +++ b/src/experimental.jl @@ -7,6 +7,12 @@ export MultiPropertyLens const NNamedTupleLens{N,s} = NamedTuple{s, T} where {T <: NTuple{N, Lens}} struct MultiPropertyLens{L <: NNamedTupleLens} <: Lens lenses::L + function MultiPropertyLens(lenses::L) where {L <: NNamedTupleLens} + @warn """ + `MultiPropertyLens` is planned to be removed. Please see [`Kaleido.jl`](https://github.com/tkf/Kaleido.jl) for a couple of similar useful lenses. + """ + new{L}(lenses) + end end _keys(::Type{MultiPropertyLens{NamedTuple{s,T}}}) where {s,T} = s diff --git a/src/settable.jl b/src/settable.jl index 32ddd0a..a6bf31b 100644 --- a/src/settable.jl +++ b/src/settable.jl @@ -4,6 +4,13 @@ using MacroTools: splitdef, combinedef using MacroTools: splitstructdef, isstructdef, combinestructdef macro settable(ex) + @warn """ + `Setfield.@settable` is planned to be removed. We believe that it is no longer needed. + Please try to remove it from your code. This might involve fixing some constructor calls, + but should be easy. If it turns out hard and you believe you have a use case, where `@settable` + is really crucial, please open an issue in the `Setfield` github repo: + https://github.com/jw3126/Setfield.jl/issues + """ esc(settable(__module__, ex)) end From 8fa0ff1e56505ffabd8d976ce931a028db7827c4 Mon Sep 17 00:00:00 2001 From: Jan Weidner Date: Mon, 6 Jan 2020 22:52:54 +0100 Subject: [PATCH 2/2] use Base.depwarn for deprecations --- src/experimental.jl | 3 ++- src/settable.jl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/experimental.jl b/src/experimental.jl index 11102e1..41f5e20 100644 --- a/src/experimental.jl +++ b/src/experimental.jl @@ -8,9 +8,10 @@ const NNamedTupleLens{N,s} = NamedTuple{s, T} where {T <: NTuple{N, Lens}} struct MultiPropertyLens{L <: NNamedTupleLens} <: Lens lenses::L function MultiPropertyLens(lenses::L) where {L <: NNamedTupleLens} - @warn """ + msg = """ `MultiPropertyLens` is planned to be removed. Please see [`Kaleido.jl`](https://github.com/tkf/Kaleido.jl) for a couple of similar useful lenses. """ + Base.depwarn(msg, :MultiPropertyLens) new{L}(lenses) end end diff --git a/src/settable.jl b/src/settable.jl index a6bf31b..349c0e1 100644 --- a/src/settable.jl +++ b/src/settable.jl @@ -4,13 +4,14 @@ using MacroTools: splitdef, combinedef using MacroTools: splitstructdef, isstructdef, combinestructdef macro settable(ex) - @warn """ + msg = """ `Setfield.@settable` is planned to be removed. We believe that it is no longer needed. Please try to remove it from your code. This might involve fixing some constructor calls, but should be easy. If it turns out hard and you believe you have a use case, where `@settable` is really crucial, please open an issue in the `Setfield` github repo: https://github.com/jw3126/Setfield.jl/issues """ + Base.depwarn(msg, Symbol("@settable")) esc(settable(__module__, ex)) end