JuliaIO / BufferedStreams.jl

Fast composable IO streams
MIT License
42 stars 20 forks source link

Base.nb_available is deprecated in Julia 0.7 and gone in 1.0 #53

Closed GunnarFarneback closed 6 years ago

GunnarFarneback commented 6 years ago

BufferedStreams extends Base.nb_available for BufferedInputStream. In Julia 0.7, Base.nb_available is deprecated, but extending it gives no warning since the function itself still exists. However, in current master, and thus in Julia 1.0, the deprecation is removed, causing the function to no longer exist at all and therefore it cannot be extended, giving a load error from using BufferedStreams.

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.0-rc1.5 (2018-08-07 20:49 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit d038f2f (0 days old master)
|__/                   |  x86_64-linux-gnu

julia> using BufferedStreams
[ Info: Precompiling BufferedStreams [e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d]
ERROR: LoadError: LoadError: UndefVarError: nb_available not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
 [2] top-level scope at none:0
 [3] include at ./boot.jl:317 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1038
 [5] include at ./sysimg.jl:29 [inlined]
 [6] include(::String) at /home/gunnar/.julia/dev/BufferedStreams/src/BufferedStreams.jl:3
 [7] top-level scope at none:0
 [8] include at ./boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at ./loading.jl:1038
 [10] include(::Module, ::String) at ./sysimg.jl:29
 [11] top-level scope at none:2
 [12] eval at ./boot.jl:319 [inlined]
 [13] eval(::Expr) at ./client.jl:389
 [14] top-level scope at ./none:3
in expression starting at /home/gunnar/.julia/dev/BufferedStreams/src/bufferedinputstream.jl:112
in expression starting at /home/gunnar/.julia/dev/BufferedStreams/src/BufferedStreams.jl:38
ERROR: Failed to precompile BufferedStreams [e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d] to /home/gunnar/.julia/compiled/v1.0/BufferedStreams/wMWKi.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
 [4] _require(::Base.PkgId) at ./logging.jl:311
 [5] require(::Base.PkgId) at ./loading.jl:852
 [6] macro expansion at ./logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:834

The obvious solution would be to rename nb_available to bytesavailable like in Base. What is less obvious is whether BufferedStreams wants to provide a deprecation of its own and from which Julia version to make the name switch.

TransGirlCodes commented 6 years ago

Thanks @GunnarFarneback, I'll make sure to make the name change at the JuliaCon hackathon if not before then!

TransGirlCodes commented 6 years ago

All sorted now in latest release :)