julia> conn = connect(1234)
ERROR: UndefVarError: connect not defined
Stacktrace:
[1] top-level scope at REPL[1]:1
更新后它不起作用,所以是否有任何新关键字被替换?
help?> connect
search: continue countlines count_ones
Couldn't find connect
Perhaps you meant convert, collect, const, count or conj
No documentation found.
Binding connect does not exist.
最佳答案
在尝试将预先存在的代码移植到 julia 1.x 时,Julia 0.7 版是一个方便的工具:对于 Julia 1.0.0 中已弃用的所有函数,julia 0.7 中会显示警告。
在connect
的具体情况下:
shell$ julia-0.7.0 _
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _ | |
| | |_| | | | (_| | | Version 0.7.0 (2018-08-08 06:46 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> connect
WARNING: Base.connect is deprecated: it has been moved to the standard library package `Sockets`.
Add `using Sockets` to your imports.
in module Main
connect (generic function with 8 methods)
按照此消息中提供的信息,
connect
现在应该用作:using Sockets
socket = connect(1234)
关于julia - 什么是 Julia 中 connect 的替代品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59634380/