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

Support IndexStyle, IndexLinear, IndexCartesian #329

Merged
merged 1 commit into from
Feb 18, 2017
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented Feb 17, 2017

README.md Outdated
@@ -101,6 +101,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `bytestring` has been replaced in most cases with additional `String` construction methods; for 0.4 compatibility, the usage involves replacing `bytestring(args...)` with `Compat.String(args...)`. However, for converting a `Ptr{UInt8}` to a string, use the new `unsafe_string(...)` method to make a copy or `unsafe_wrap(String, ...)` to avoid a copy.

* In 0.6, older non-exported indexing traits were renamed and exported as `IndexStyle`, `IndexLinear`, and `IndexCartesian`. Any code specializing `Base.linearindexing(::Type{T})` should switch to `Compat.IndexStyle(::Type{T})`.
Copy link
Member

Choose a reason for hiding this comment

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

The correct form is ::Type{<:T} AFAIK.

Copy link
Member Author

Choose a reason for hiding this comment

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

I know, I was just being brief and didn't want to exclude notation that was valid on 0.5. I'll try to change it to be more explicit about old and new syntax.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but I know I got it wrong the first time, so I would say it's worth being explicit since people are likely to copy/paste the suggested solution. You could use @compat Compat.IndexStyle(::Type{<:T}) (or just use the old syntax).

README.md Outdated
@@ -78,6 +78,8 @@ Currently, the `@compat` macro supports the following syntaxes:
* `@compat A{T} = B{T}` or `@compat const A{T} = B{T}` to declare type alias with free
parameters. [#20500]. Use `const A = B` for type alias without free parameters.

* `@compat Compat.IndexStyle(::Type{<:MyArray}) = IndexLinear()` and `@compat Compat.IndexStyle(::Type{<:MyArray}) = IndexCartesian()` to define traits for abstract arrays, replacing the former `Base.linearindexing{T<:MyArray}(::Type{T}) = Base.LinearFast()` and `Base.linearindexing{T<:MyArray}(::Type{T}) = Base.LinearSlow()`, respectively.
Copy link
Member Author

Choose a reason for hiding this comment

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

Or should we allow people to write this as @compat Base.IndexStyle(...), effectively lying about which module IndexStyle is defined in?

Copy link
Member

Choose a reason for hiding this comment

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

I would say either solution is fine. Base.IndexStyle might be a bit better since people will just have to remove @compat to get the official 0.6 syntax, but not a big deal.

@timholy
Copy link
Member Author

timholy commented Feb 17, 2017

Tests pass. I have a growing collection of packages for which I have PRs ready to queue, so would be great to merge this soon and tag a new release.

@andreasnoack andreasnoack merged commit 9a95537 into master Feb 18, 2017
@timholy timholy deleted the teh/IndexStyle branch February 18, 2017 09:01
martinholters added a commit that referenced this pull request Aug 27, 2018
Was added in #329, 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
* 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.
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