How to fix the warning for this deprecated syntax

How to fix the warning for this code?

function Base.call{T}(expt::Experiment{T}, D::Matrix; inc=expt.inc)
    simulate(T, D, inc...)
end 

WARNING: deprecated syntax “call(expt::Experiment{T}, …)”.
Use “(expt::Experiment{T})(…)” instead.

This is how the new syntax would look like:

function (expt::Experiment{T})(D::Matrix; inc=expt.inc) where {T}
    simulate(T, D, inc...)
end

Thank you for your answer, but how to write it in version 0.5?

I have error with version 0.5:
“ERROR: LoadError: LoadError: syntax: space before “{” not allowed in “where {”
in include_from_node1(::String) at ./loading.jl:488
in include_from_node1(::String) at /usr/local/Cellar/julia/0.5.1/lib/julia/sys.dylib:?
in eval(::Module, ::Any) at ./boot.jl:234
in eval(::Module, ::Any) at /usr/local/Cellar/julia/0.5.1/lib/julia/sys.dylib:?
in require(::Symbol) at ./loading.jl:415
in require(::Symbol) at /usr/local/Cellar/julia/0.5.1/lib/julia/sys.dylib:?
in include_from_node1(::String) at ./loading.jl:488
in include_from_node1(::String) at /usr/local/Cellar/julia/0.5.1/lib/julia/sys.dylib:?
in process_options(::Base.JLOptions) at ./client.jl:265
in _start() at ./client.jl:321
in _start() at /usr/local/Cellar/julia/0.5.1/lib/julia/sys.dylib:?
while loading /Users/nguyenvu/.julia/v0.5/ElementSimulator/src/ElementSimulator.jl, in expression starting on line 71
while loading /Users/nguyenvu/.julia/v0.5/Materials2/test/runtests.jl, in expression starting on line 1”

If you are rewriting code from < v0.5 anyway, perhaps you would be better off switching to v0.6.2 without further ado, saving an extra rewrite. The NEWS.md files in the Julia repository have the release notes (select with a tag) which list the changes.

2 Likes