JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.8k stars 5.49k forks source link

Provide deprecation information as help for deprecated functions #18737

Open dpsanders opened 8 years ago

dpsanders commented 8 years ago

The replacement (if there is one) for deprecated functions should be given when help is asked for; the following doesn't help me remember what to replace bytestring by:

help?> bytestring
search: bytestring

  No documentation found.

  Base.bytestring is a Function.

  #7 methods for generic function "bytestring":
  bytestring(v::Array{UInt8,1}) at deprecated.jl:49
  bytestring(s::Cstring) at deprecated.jl:49
  bytestring(io::Base.AbstractIOBuffer) at deprecated.jl:49
  bytestring(p::Union{Ptr{Int8},Ptr{UInt8}}) at deprecated.jl:49
  bytestring(p::Union{Ptr{Int8},Ptr{UInt8}}, len::Integer) at deprecated.jl:49
  bytestring(s::AbstractString...) at deprecated.jl:49
  bytestring(str::Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("llvm::StringRef")},(false,false,false)},N<:Any}) at /Users/dpsanders/.julia/v0.5/Cxx/src/show.jl:1
fredrikekre commented 7 years ago

I implemented something at this branch: https://github.com/fredrikekre/julia/commit/c87fff4be62eea0941b9718ab2da6da9061ae317

This attaches the deprecation string as a documentation for deprecated function signatures and deprecated symbols (if they are deprecated with @deprecate). The problem is that these docstrings also leak into the documentation; so if people like this, then we need to make sure that deprecated method signatures are excluded from the docs.

Example: screenshot from 2017-05-31 15-48-57