Skip to content
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 at-dot, at-view, and at-views macros; improve at-compat for .= & .+= #316

Merged
merged 5 commits into from
Feb 7, 2017

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented Feb 3, 2017

This backports the @view (JuliaLang/julia#16564), @views (JuliaLang/julia#20164), and @__dot__ macros (JuliaLang/julia#20321).

It also fixes the @compat handling of .= when the left-hand-side is an array reference, and adds @compat support for .+= and similar.

@@ -1596,11 +1596,106 @@ A = view(rand(5,5), 1:3, 1:3)
@test A*D == copy(A) * Diagonal(copy(x))

# julia#17623
@static if VERSION >= v"0.5.0-dev+5509" # To work around unsupported syntax on Julia 0.4
if VERSION >= v"0.5.0-dev+5509"
# Use include_string to work around unsupported syntax on Julia 0.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@static was fine wasn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least the CI in #304 seemed to think that @static does not exist in 0.4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't, but it should exist in Compat

Copy link
Member Author

@stevengj stevengj Feb 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was passing with @static, but was still giving a warning in 0.4 (because the warning occurs in the parser, which runs before the macro expansion).

test/runtests.jl Outdated

# the following tests fail on 0.5 because of bugs in the 0.5 Base.@view
# macro (a bugfix is scheduled to be backported from 0.6)
if VERSION < v"0.5"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be more specific, otherwise it'll fail on later prereleases and rc's

README.md Outdated

* `@views` takes an expression and converts all slices to views ([#20164]), while
`@view` ([#16564]) converts a single array reference to a view ([#20164]). Using `@views`
automatically implies `@compat`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given the cutoffs will differ for when @views will be used from base vs here, relative to everything else @compat transforms I don't think this should be automatic

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll see if I can accommodate this; the interaction with .= is a little tricky.

@stevengj
Copy link
Member Author

stevengj commented Feb 5, 2017

Rebased to eliminate a merge conflict.

Tests were green before the rebase; assuming they go green again, this should be good to merge?

@stevengj
Copy link
Member Author

stevengj commented Feb 7, 2017

Will merge tomorrow if there are no objections.

@stevengj
Copy link
Member Author

stevengj commented Feb 7, 2017

@tkelman, why did you delete the newlines at the ends of the files?

@tkelman
Copy link
Contributor

tkelman commented Feb 7, 2017

the conflict resolver is annoying like that, wasn't intentional

@tkelman
Copy link
Contributor

tkelman commented Feb 7, 2017

if you want to rebase that commit out go ahead, not sure it's worth the CI time though

@stevengj stevengj merged commit 63beaae into master Feb 7, 2017
@stevengj stevengj deleted the arraymacros branch February 7, 2017 13:20
martinholters added a commit that referenced this pull request Aug 27, 2018
* new style call overloading (added in #181, removed in #385)
* `get(io, s false)` (added in #212, #215, #225, removed in #385)
* `.=` (added in #292 and #316, removed in #372)
martinholters added a commit that referenced this pull request Aug 31, 2018
* Remove at-compat for type aliases

  Was added in #326, now obsolete as no longer required on minimum
  supported Julia version 0.6.

* Remove at-compat for Nullable construction

  Was added in #287, now obsolete as no longer required on minimum 
  supported Julia version 0.6.

* Remove at-compat for Foo{<:Bar} sugar

  Was added in #317 (and #336), now obsolete as no longer required on 
  minimum supported Julia version 0.6.

* Remove at-compat for index styles

  Was added in #329, now obsolete as no longer required on minimum 
  supported Julia version 0.6.

* Remove at-compat for type declarations

  Was added in #325, now obsolete as no longer required on minimum 
  supported Julia version 0.6.

* Remove unused at-compat helper functions

* Remove README entries for removed at-compat functionality

  * new style call overloading (added in #181, removed in #385)
  * `get(io, s false)` (added in #212, #215, #225, removed in #385)
  * `.=` (added in #292 and #316, removed in #372)

* Remove `Compat.collect(A)`

  Was added in #350 and #351, now obsolete as no longer required on 
  minimum supported Julia version 0.6.
martinholters added a commit that referenced this pull request Aug 31, 2018
These were added in #316 for Julia versions older than 0.6. The 
at-dotcompat macro is kept to avoid breakage.
stevengj pushed a commit that referenced this pull request Aug 31, 2018
These were added in #316 for Julia versions older than 0.6. The 
at-dotcompat macro is kept to avoid breakage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants