Conversation
README.md
Outdated
| * `bswap` is supported for `Complex` arguments on 0.5 and below. ([#21346]) | ||
|
|
||
| * `Compat.invokelatest` is equivalent to `Base.invokelatest` in Julia 0.6, | ||
| but works Julia 0.4+, and allows you to guarantee that a function call |
There was a problem hiding this comment.
"works on Julia 0.4+" (or "in"?)
| if isdefined(Base, :invokelatest) | ||
| import Base.invokelatest | ||
| else | ||
| invokelatest(f, args...) = eval(Expr(:call, f, map(QuoteNode, args)...)) |
There was a problem hiding this comment.
While this surely is the correct definition for invokelatest, prior to JuliaLang/julia#17057 just f(args...) would often also work and be more performant. I'd surely have use for a function that does just f(args...) in older Julia and invokelatest (or eval(...)) in newer Julia. Should we include this in Compat?
There was a problem hiding this comment.
@martinholters, that's not true. Prior to that PR, you might get some random obsolete version of a function. See, for example JuliaLang/julia#7884 ... we had to add something like this in IJulia long before 17057.
There was a problem hiding this comment.
I know. But I use eval to create anonymous functions for which there cannot be obsolete versions. But that might be a very specific use case of mine.
There was a problem hiding this comment.
The point is, this seems to be about the simplest correct definition of invokelatest on earlier Julia versions. Your suggestion above would not work in general, hence it is not appropriate for Compat.
There was a problem hiding this comment.
Sorry for the misunderstanding: I didn't want to propose replacing what you have done, merely suggest to consider the simplified definition in addition. But admittedly, it doesn't really fit into Compat and I have no API proposal, so let's forget about it.
|
Travis failure on 0.4 OSX seems unrelated: |
|
Okay to merge? |
* `zeros` and `ones` with interface of `similar` (from #330) * `convert` between `Set` types (from #342) * `isassigned(::RefValue)` (from #345) * `unsafe_trunc(::Type{<:Integer}, ::Integer)` (from #344) * `bswap` for complex numbers (from #346) * Compat.StringVector (from #348) * `invokelatest` (from #352 and #359) * Misc. pre-0.6-only code * obsolete README enries
This adds
Compat.invokelatestfor theBase.invokelatestfunction introduced in JuliaLang/julia#19784