Even though experimenting with the command line is an important part of
learning a about language, you can usually figure out conceptual
features better from reading the documentation. In particular, release
notes inform about deprecations.
[...] was used frequently to convert to a vector, but it is deprecated,
and no longer needed in most cases. Usually you can work with range
objects without converting them to a vector. If not, share an example
and you will most likely get more specific help.
I am not sure what the question is about {}. It has been deprecated so
that it can be freed for new syntax. See
https://github.com/JuliaLang/julia/pull/10380
Best,
Tamas
On Tue, Mar 29 2016, Manor Askenazi wrote:
> # So, ranges are a thing:
>
> julia> 1:3
> 1:3
>
> # Not an obvious type, but OK:
>
> julia> typeof(1:3)
> UnitRange{Int64}
>
> # And they can be assigned to variable, good.
>
> julia> a = 1:3
> 1:3
>
> # WAT: A warning about using collect()?
>
> julia> a = [1:3]
> WARNING: [a] concatenation is deprecated; use collect(a) instead
> in depwarn at deprecated.jl:73
> in oldstyle_vcat_warning at
> /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
> in vect at abstractarray.jl:32
> while loading no file, in expression starting on line 0
> 3-element Array{Int64,1}:
> 1
> 2
> 3
>
> # WAT: why would a semicolon make the error go away?
>
> julia> a = [1:3;]
> 3-element Array{Int64,1}:
> 1
> 2
> 3
>
> # This makes sense, I _should_ get a warning every time...
>
> julia> a = [1:3]
> WARNING: [a] concatenation is deprecated; use collect(a) instead
> in depwarn at deprecated.jl:73
> in oldstyle_vcat_warning at
> /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
> in vect at abstractarray.jl:32
> while loading no file, in expression starting on line 0
> 3-element Array{Int64,1}:
> 1
> 2
> 3
>
> # WAT: Third time's a charm? We have apparently beaten the interpreter into
> submission :-)
>
> julia> a = [1:3]
> 3-element Array{Int64,1}:
> 1
> 2
> 3
>
> # By way of comparison, I recently ran some old code and discovered that {}
> is no longer OK:
>
> julia> {}
>
> WARNING: deprecated syntax "{}".
> Use "[]" instead.
> 0-element Array{Any,1}
>
> julia> {}
>
> WARNING: deprecated syntax "{}".
> Use "[]" instead.
> 0-element Array{Any,1}
>
> # And apparently in this case, the interpreter will insist _forever_ ...
>
> julia> {}
>
> WARNING: deprecated syntax "{}".
> Use "[]" instead.
> 0-element Array{Any,1}