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 iteratorsize #47

Merged
merged 3 commits into from
May 27, 2016
Merged

Add iteratorsize #47

merged 3 commits into from
May 27, 2016

Conversation

oxinabox
Copy link
Contributor

This should fix it with v0.5 of Julia. Re: all iterators are broken.
To be honest I haven't tested this version directly, am doing a quick commit and am relying on TravisCI to test it. If this doesn't CI I'll do a more careful branch and fix.

This problem is referenced in #46 (comment)

See: JuliaLang/julia#15977 and the linked documentation gist

@oxinabox
Copy link
Contributor Author

Looks like this worked.
Failure currently showing is a timeout on one of the appveyer builds.
(I'm going to close and reopen to trigger another build)

@oxinabox oxinabox closed this May 27, 2016
@oxinabox oxinabox reopened this May 27, 2016
@@ -98,7 +98,7 @@ end
Base.start(it::XMLAttrIter) = it.p
Base.done(it::XMLAttrIter, p::Xptr) = (p == C_NULL)
Base.next(it::XMLAttrIter, p::Xptr) = (a = XMLAttr(p); (a, a._struct.next))

iteratorsize(::Type{XMLAttrIter})=SizeUnknown()

Copy link
Contributor

Choose a reason for hiding this comment

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

spaces around the =

@tkelman tkelman merged commit 19f2656 into JuliaIO:master May 27, 2016
@tkelman
Copy link
Contributor

tkelman commented May 27, 2016

Thanks!

@oxinabox
Copy link
Contributor Author

Cool.
This is my first code to have merged into someone else project.
Even if it is like 5 lines.
Yay.

@tkelman
Copy link
Contributor

tkelman commented May 28, 2016

Good to hear - I could've sworn you had a base PR merged by now. If this thing with iteratorsize comes up often in other packages it would probably be worth putting it in Compat.jl.

@mschauer
Copy link

There is something I don't get here: what is the point of defining a fallback iteratorsize(v) for version < v"0.5.0-dev+3305" which gives an error but is less specific than the actual iteratorsize methods coming later?

@oxinabox
Copy link
Contributor Author

@mschauer Good point.

I copied it direct from Iterators.jl
In particular from this PR

When I was doing so, it was on the logic that if iteratorsize was called in v0.4, it would not hit the Xml*Iter's iteratorsize-- which would result in undefined SizeUnknown. but would hit the generic one.

However that does not follow, because multiple dispatch is most specific first.

So it could just be:

if VERSION >= v"0.5.0-dev+3305"
    import Base: iteratorsize, SizeUnknown
end

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