JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.73k stars 5.48k forks source link

things we should deprecate, 0.6 edition #19598

Closed StefanKarpinski closed 7 years ago

StefanKarpinski commented 7 years ago

I'd like to collect a list of things that should be deprecated before 0.6 is released, even if we don't implement the corresponding feature until 1.0. Some examples I can think of:

Probably in 1.0 rather than 0.6:

tkelman commented 7 years ago
nalimilan commented 7 years ago

macro parsing of ~ if the stats package can come up with a @formula replacement in time

Should probably go into StatsModels now.

ararslan commented 7 years ago

Regarding formulas, see https://github.com/JuliaStats/StatsModels.jl/issues/3.

Sacha0 commented 7 years ago

Alongside @tkelman's mention of vectorized & and |, remaining vectorized methods for abs, abs2, imag, trunc, floor, ceil, mod, div, rem, clamp, and a number of hyperbolic trig functions should be deprecated. Likely vectorized big methods as well, and possibly (discussion ongoing) vectorized float, real, and (two-argument) complex methods. (I have stale pull requests open for most of those deprecations, blocked on whatever mark we set for completion of the sparse broadcast overhaul.) (edit: These are done, less those struck through.)

With devectorization complete, deprecation of expm, logm, sqrtm, and friends (i.e. matrix functions specially named due to former conflict with vectorized scalar functions) in favor of non-m equivalents might be worth considering. Best!

Edit: Also full. (I hope to see deprecating full through after completing the sparse map/broadcast overhaul (post 0.6).)

andreasnoack commented 7 years ago

I'd also propose depreaction of sumabs, sumabs2, maxabs and minabs which are not necessary with fast function arguments.

Edit: done in https://github.com/JuliaLang/julia/pull/19616 – @StefanKarpinski

simonbyrne commented 7 years ago

Various special functions, pending #4301/#8536

simonbyrne commented 7 years ago

For strings, the decision was to define a codeunit(s::String, offset::Int) function for people who need access to bytes.

StefanKarpinski commented 7 years ago

If Jeff's recent String experiment pans out, we'll do that; otherwise we rename the .data field.

tkelman commented 7 years ago
vtjnash commented 7 years ago

If Jeff's recent String experiment pans out, we'll do that; otherwise we rename the .data field.

I think we said that Jeff's recent String experiment is expected to merge in the next few months, otherwise we don't spend any other effort on changing the representation. Probably by 1.0, we will need to have the infrastructure in place to handle Arrays more efficiently via an underlying Buffer type. At that time, we can delete the special case code for String and go back to having a .data field, by showing that it gives the same (or better) performance.

JeffBezanson commented 7 years ago

Another candidate: produce and consume, in favor of channels.

amitmurthy commented 7 years ago

Another candidate: produce and consume, in favor of channels.

https://github.com/JuliaLang/julia/issues/17699

blakejohnson commented 7 years ago

With devectorization complete, deprecation of expm, logm, sqrtm, and friends (i.e. matrix functions specially named due to former conflict with vectorized scalar functions) in favor of non-m equivalents might be worth considering.

I agree, but these need to wait one release so that we can suggest the alternate spelling without the m.

ararslan commented 7 years ago

The manual has claimed the Array(T, dims) syntax to be "deprecated" for a while now, but no deprecation warning is emitted. If we really want that syntax to be deprecated, we should formally deprecate it.

goszlanyi commented 7 years ago

What was wrong with Array(T,dims)? It was concise, easy to remember and similar to zeros(T,dims) and ones(T,dims). Could you point to the issue where it happened, please.

ararslan commented 7 years ago

What was wrong with Array(T,dims)?

It's not a proper type constructor; Array is a parametric type, so it should be constructed with a type parameter.

Could you point to the issue where it happened, please.

Jeff added the text in this commit: https://github.com/JuliaLang/julia/commit/23a6995a560ae88c14bf8e299faec7a4688df3f9

StefanKarpinski commented 7 years ago

Ok, as far as I can tell the remaining items to deprecate are:

[List moved to top comment]

Everything else is either already deprecated or has a fresh PR pending.

mbauman commented 7 years ago

partial linear indexing – any chance of this, @mbauman?

I can definitely deprecate it. I'm not sure I'll be able to resolve all the deprecations in a timely manner, though. Right now it's blocked on #18457. Once that is merged I can push a deprecation branch and we can crowd-source the deprecation fixes.

ararslan commented 7 years ago

~ macro syntax – how do we do this?

This is what @tkelman suggested for that:

maybe Base could keep ~ parsing as a macro but always throwing a depwarn? Looks like this may not change in Base for 0.6, but if packages can be made ready then maybe we hard change the parsing during 1.0-dev and packages might not notice if they've transitioned to this?

That would be the least immediately-breaking course of action, I would think. Once we do stop parsing ~ as a macro, we just have to make sure it still parses as an infix call with the same precedence.

simonbyrne commented 7 years ago
JeffBezanson commented 7 years ago

Also:

type Foo{T}
    x
    Foo(x) = new(x)
end

currently gets rewritten to

    (::Type{Foo{T}}){T}(x) = new{T}(x)

which is bad, because the definition looks like it defines Foo(x) but it doesn't.

    Foo{T}(x) where T<:Any = new{T}(x)   # or possibly just `new(x)`

These require #18457.

simonbyrne commented 7 years ago

There are also some changes to LibGit2 we should make before 1.0 (#19839), but I'm not sure if I'll have time to get to them before then.

pabloferz commented 7 years ago

I'd add

timholy commented 7 years ago

Possibly come up with two different names for one, #16116

tkelman commented 7 years ago

full@Sacha0, how are we on this?

ref https://github.com/JuliaLang/julia/pull/18850 and https://github.com/JuliaLang/julia/pull/17082, planned for post-0.6 was my understanding

tkelman commented 7 years ago

~ macro syntax – how do we do this?

Discussion on the triage call is that the deprecation of ~ should be done in DataFrames since it's the only place out of all registered packages that defines a macro ~. If StatsModels.jl can be registered and a release-able branch of DataFrames can hook up to it in the next couple weeks, then we could upper-bound all existing releases of DataFrames so they're not installable on 0.6, only versions that support the new @formula macro from StatsModels.jl would support 0.6-and-newer. Then we could change the parsing in Base for 0.6 without needing any other deprecation.

Sacha0 commented 7 years ago

full – @Sacha0, how are we on this?

ref #18850 and #17082, planned for post-0.6 was my understanding

Depending on when true feature freeze occurs, I might manage to complete full deprecation this cycle (edit: not enough time). I planned to prioritize other projects (stopgap map[!]/broadcast[!] over structured matrices, two-argument sparse broadcast!, any remaining devectorization tasks), though I would be happy to reprioritize full? Best!

Sacha0 commented 7 years ago

vectorized isinteger, et al.

@StefanKarpinski, have you functions apart from isinteger in mind? iszero and isreal also reduce over arrays (though not isimag); latest discussion in https://github.com/JuliaLang/julia/pull/17623#discussion_r92529652 and https://github.com/JuliaLang/julia/pull/18495#issuecomment-267215901. Best!

tkelman commented 7 years ago

I didn't even realize until #19928 that ifelse is vectorized over AbstractArray{Bool} first inputs, good candidate for replacing with dot call broadcast?

simonster commented 7 years ago

In https://github.com/JuliaLang/julia/pull/19912#issuecomment-271145955 @stevengj proposed:

JeffBezanson commented 7 years ago

fill! and a .= b don't do the same thing. If both arguments are arrays, fill! still tries to set every element of a to the same array b, while .= copies elements from b to a.

julia> a = Array{Any}(3)
3-element Array{Any,1}:
 #undef
 #undef
 #undef

julia> b = rand(2,2)
2×2 Array{Float64,2}:
 0.30943   0.803133
 0.188654  0.709538

julia> fill!(a, b)
3-element Array{Any,1}:
 [0.30943 0.803133; 0.188654 0.709538]
 [0.30943 0.803133; 0.188654 0.709538]
 [0.30943 0.803133; 0.188654 0.709538]
simonster commented 7 years ago

That is a good point, but is there any difference between a[:] = b and fill!?

JeffBezanson commented 7 years ago

I think a[:] = b is more similar to a .= b, except the number of elements have to match since it doesn't broadcast.

simonster commented 7 years ago

Ah, I see. So I guess fill! needs to stick around.

andreasnoack commented 7 years ago

I wouldn't miss the behavior of fill! described by @JeffBezanson.

Sacha0 commented 7 years ago

Possibly ! vectorized over AbstractArray{Bool} as in https://github.com/JuliaLang/julia/issues/20037#issuecomment-272647370? (Edit: Also over BtArray. Likewise ~.) Best!

tkelman commented 7 years ago

How's DataFrames doing, can we remove ~ parsing as a macro yet?

quinnj commented 7 years ago

@nalimilan ^?

StefanKarpinski commented 7 years ago

Can I have a link to a PR for the DataFrames ~ change so we can track it from here more easily?

StefanKarpinski commented 7 years ago

I've reorganized this issue so that all the todos are in the top comment. A few comments:

If the answer to any of the above is "no", that's ok, just want to update the list so we know what we're still waiting on.

nalimilan commented 7 years ago

@ararslan is the one to ask regarding the ~ changes, but at least the needed changes have been merged in StatsModels (https://github.com/JuliaStats/StatsModels.jl/pull/9, I've added the link to the description). We still need to make DataFrames use that, though.

StefanKarpinski commented 7 years ago

Now that the StatsModels change has happened (thanks, @ararslan!), I don't think the other two changes need to happen in order since they're about tagging new versions and getting the dependencies right. So the next action item there seems to be a PR to change ~ to an operator.

timholy commented 7 years ago

Yes, I agree that the changes for one are easy (docstring and adding a new function). Fixing base can come later.

stevengj commented 7 years ago

I actually started on a patch for one. Making Base dimensionally correct requires a big effort

stevengj commented 7 years ago

See #20268.

mbauman commented 7 years ago

Is it possible to deprecate using _ as an rvalue?

StefanKarpinski commented 7 years ago

Good call, @mbauman – need to do that now in order to use it for discarding values in 1.0.

amitmurthy commented 7 years ago

Also

ararslan commented 7 years ago

A few FYIs from me:

Special functions: I've been working on moving special functions out of Base. From a package standpoint it's nearly there, but from a modification to Base standpoint there's still a fair bit of work to be done. In particular, to remove the dependency on openspecfun, we'll need to reimplement rem2pi in pure Julia, which requires double-double arithmetic. Unless we can extend and use Base.TwicePrecision for this, we need a solid double-double arithmetic implementation in Base. I think it's unlikely that this will happen for 0.6.

FFTW: As another data point, I've also been working on moving FFTW into a package. That too is going well, though there is still quite a bit of work to be done in moving from makefiles to BinDeps. Similarly unlikely to make it into 0.6.

StefanKarpinski commented 7 years ago

As a temporary solution, could we just copy-pasta the one function you need from openspecfun into libjulia for now, with the longer term plan of reimplementing it in pure Julia?