Depreciation warning with ones()

Hello everybody,

I have a brief question regarding a depreciation warning I get on 0.7-beta.

Consider

julia> m=2.0
2.0

julia> ones(m)
┌ Warning: `ones(dims...)` is deprecated, use `ones(convert(Dims, dims)...)` instead.
│   caller = top-level scope at none:0
└ @ Core none:0
2-element Array{Float64,1}:
 1.0
 1.0

Obviously the fact that m is a Float64 scalar is the problem (and was in fact a bug). However it took me several minutes to understand this because of the wording of the Warning which I think is highly confusing. From “convert(Dims, dims)” I was looking for an actual multi-dimensional object as the trigger and at first assumed this Warning was completely bogus.

Does it make sense to file a bug report about this ?

In any case someone else might now be able to save some minutes if google picks this up.

Cheers

Christof

As you surmised, all this is telling you is to pass it an integer instead of a float. Good deprecation messages are hard—you can usually do correct or simple but often not both. This particular one could probably be specialized to be less confusing. An issue about improving it would be helpful!

1 Like

Hello,

This is done, #27795.

Best Regards

Christof

2 Likes