-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .& and .| #306
Add .& and .| #306
Conversation
can this work in an at-compat macro on 0.4? |
Not that I know of unfortunately. |
And even worse, it sometimes does not parse at all: julia> X .& Y
WARNING: deprecated syntax "X .".
Use "X." instead.
ERROR: syntax: extra token "Y" after end of expression |
|
||
# julia#17623 | ||
if VERSION >= v"0.5.0" | ||
@eval quote # To work around unsupported syntax on Julia 0.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would at-static work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't exist on 0.4...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compat implements it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, great. That works here, but not in the other file, since just parsing the syntax is an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that's what at-static was supposed to help with. and it's exported so shouldn't need at-compat to use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@static
doesn't really help parsing error. It can avoid lowering error if something parses but raises error/depwarn during lowering or type inference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the present case it fixes the error on 0.4, though the deprecation warnings remain.
# To work around unsupported syntax on Julia 0.4 | ||
parse("export .&, .|") | ||
parse(".&(xs...) = broadcast(&, xs...)") | ||
parse(".|(xs...) = broadcast(|, xs...)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these will return Exprs, did you mean include_string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, I got that totally wrong. Since I made the same mistake in tests, no wonder why they passed. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at-static would look better here too
fcd3b92
to
19e0370
Compare
Another question to address: the PR currently replaces |
Bump. This is needed to fix DataFrames on 0.6, among others. |
@@ -1759,4 +1759,11 @@ if VERSION < v"0.5.0-dev+3669" | |||
scale!(similar(A, promote_op(*, eltype(A), eltype(D.diag))), D.diag, A) | |||
end | |||
|
|||
if VERSION >= v"0.5.0" && VERSION < v"0.6.0-dev.1614" | |||
# To work around unsupported syntax on Julia 0.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we know what would have made these first parse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand the question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was some pr during 0.5-dev that first made these parse, right? "parse more dot operators" by stevengj I want to say?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've made the check specific to that commit.
Would be nice if we could get CI working on nightly... I don't see a Compat issue for this? |
These replace element-wise & and |, which are deprecated in Julia 0.6. This syntax is not supported by Julia 0.4.
AppVeyor failure due to network error. |
Good to go now? |
@@ -1759,4 +1759,11 @@ if VERSION < v"0.5.0-dev+3669" | |||
scale!(similar(A, promote_op(*, eltype(A), eltype(D.diag))), D.diag, A) | |||
end | |||
|
|||
if VERSION >= v"0.5.0-dev+5509" && VERSION < v"0.6.0-dev.1614" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how did you get the 1614 cutoff? I think that's wrong, I get 1632 at the merge commit b0a41531fc4a0345710375adb3d7f40b6220ae91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1614 corresponds to commit JuliaLang/julia@f216cbb, from JuliaLang/julia#17623 for which 1632 is the merge commit. Which is the most correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The merge commit. Otherwise you're counting relative to where work on the PR branched off from, and there's going to be overlap for commits from master that don't have the feature. Linear numbering isn't quite sufficient to capture "newer or older than a given commit" so we should probably move towards feature tests where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, see #318.
@nalimilan, |
worth noting the method definition of this as broadcast is implemented by Compat on 0.5 JuliaLang/Compat.jl#306
* Remove `take!(::Task)` definition for Julia versions prior to 0.6 Was added in #307. * Remove `redirect_std*(f, stream)` definitions for Julia prior to v0.6 Were added in #275. * Remove at-__DIR__ macro definition for Julia versions prior to 0.6 Was added in #281. * Remove `broadcast` definition for equal-length tuples Was added in #324 and #328 * Remove definitions of `unsafe_get` and `isnull` fallsback Were added in #287. * Remove defintions of `xor` and `⊻` Were added in #289. * Definitions of `numerator` and `denominator` Were added in #290. * Remove defintion of `iszero` Was added in #305. * Remove definition of `>:` Was added in #336 * Remove definition of `take!(::Base.AbstractIOBuffer)` Was added in #290. * Remove definiton of `.&` and `.|` Were added in #306. * Remove definition of `Compat.isapprox` Was added in #309.
These replace element-wise & and |, which are deprecated in Julia 0.6.
This syntax is not supported on 0.4 (raises a deprecation warning).
(Failure on nightlies is unrelated.)