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

Use new inner constructor and type declaration syntax #107

Merged
merged 3 commits into from
Feb 23, 2017

Conversation

andreasnoack
Copy link
Member

The new syntax for inner constructors doesn't parse on 0.5 so it will be ugly and more demanding to support on both versions. Furthermore, 0.6 will be out soon and nobody will care about 0.5. If they care anyway and we add features then we can backport those features to a 0.5 branch.

@andyferris
Copy link
Member

LGTM. Thanks Andreas.

Just so you know, I was planning on merging and releasing #105 first, before merging this one. This plus major changes due to #106 are required before this package is usable on v0.6. Those other changes are backward compatible so maybe they should be released for v0.5 too (otherwise it would block backporting).

Would a @static if VERSION < ... version of this PR be a sensible approach? Or is it better all-round to focus development on a single version of Julia?

@andyferris
Copy link
Member

CI is complaint about TupleN

@andreasnoack
Copy link
Member Author

andreasnoack commented Feb 19, 2017

The problem is that the syntax doesn't parse at all so we'll end up with a lot of definitions like https://github.com/Evizero/UnicodePlots.jl/blob/master/src/graphics/bargraphics.jl#L1-L44 which I think is ugly. Personally, I think it is better to focus development hours on 0.6 and thereafter instead of compatibility.

There is a problem with the build bots so CI is running with old binaries that don't have the latest syntax changes. Tests pass locally on latest master.

@c42f
Copy link
Member

c42f commented Feb 20, 2017

I think merging this might be a bit premature - are the change here required to make the package work on 0.6, or are they syntactic niceties? If possible it would be nice for master to continue working with 0.5 for a while.

@andreasnoack
Copy link
Member Author

The inner constructor syntax is deprecated so it gives warnings on master. The only way to make it work across 0.5 and 0.6 is to write that code as strings and use include_string conditionally on the version such as in the link I posted above.

@timholy
Copy link
Member

timholy commented Feb 20, 2017

There is always the (::Type{MyNewType{T}}){T}(arg) = new{T}(arg) syntax, which works on both.

@andreasnoack
Copy link
Member Author

Thanks for pointing that out. I wasn't aware of that. I'll update the PR.

@andreasnoack andreasnoack force-pushed the master branch 2 times, most recently from d340f7d to a33600e Compare February 20, 2017 15:11
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 67.452% when pulling a33600e on andreasnoack:master into 1be47cc on JuliaArrays:master.

@andyferris
Copy link
Member

Thanks Andreas (and good idea, Tim).

I still think it would be better to delay this for just the moment and first address #106, which completely and utterly destroys any custom subtypes of StaticArray, is a much larger amount of work, and the fix is compatible with Julia v0.5.

At that point we can base development on v0.6 (and backport crucial fixes to v0.5 - but not fixing #106 first will make any backports less trivial). This will let us (in no particular order):

  • Not require Compat.
  • Make use of where syntax to simplify dispatch (e.g. this).
  • Let us take advantage of compiler (specifically, inference and constant propagation) improvements (this will mean, less @generated functions).
  • Keep code cleaner.

Basically, this package is unusually low-level and reliant on certain compiler behavior - I'd rather not have this package be artificially limited by continuing to support two versions of Julia.

I do apologize about the deprecation warning noise between now and then - I would suggest to keep rebasing this branch on the other changes for the next little while, and use this branch for downstream development work targeting v0.6 in the meantime.

I am also open to dropping v0.5 support now if people think this is a better route (how many backports will there really be?). But please, do keep in mind how completely broken custom static arrays are - deprecation warnings might be a good warning-sign for users :)

tkoolen added a commit to JuliaRobotics/RigidBodyDynamics.jl that referenced this pull request Feb 21, 2017
tkoolen added a commit to JuliaRobotics/RigidBodyDynamics.jl that referenced this pull request Feb 21, 2017
tkoolen added a commit to JuliaRobotics/RigidBodyDynamics.jl that referenced this pull request Feb 21, 2017
tkoolen added a commit to JuliaRobotics/RigidBodyDynamics.jl that referenced this pull request Feb 21, 2017
Based on JuliaArrays/StaticArrays.jl#107 (comment).

fix mistake in TreeVertex constructor

Fix MechanismState constructor
tkoolen added a commit to JuliaRobotics/RigidBodyDynamics.jl that referenced this pull request Feb 21, 2017
Based on JuliaArrays/StaticArrays.jl#107 (comment).

fix mistake in TreeVertex constructor

Fix MechanismState constructor
tkoolen added a commit to JuliaRobotics/RigidBodyDynamics.jl that referenced this pull request Feb 21, 2017
Based on JuliaArrays/StaticArrays.jl#107 (comment).

fix mistake in TreeVertex constructor

Fix MechanismState constructor
@andreasnoack
Copy link
Member Author

I don't really understand why merging these small deprecation warning fixes could be a problem for fixing custom static arrays. Notice, that the PR doesn't drop 0.5 anymore.

@andyferris
Copy link
Member

I suppose it should be OK now that I'm tagging the similar_type changes. I'll be ripping out Compat sometime soon when we go to v0.6-only.

@andreasnoack this PR now has conflicts (my fault)

@c42f
Copy link
Member

c42f commented Feb 22, 2017

Nice, thanks for putting up with 0.5 for a little longer :-)

typealias Mat2d Mat{2,2, Float64, 4}
typealias Mat3d Mat{3,3, Float64, 9}
typealias Mat4d Mat{4,4, Float64, 16}
@compat const Vec1d = Vec{1, Float64}
Copy link
Member

Choose a reason for hiding this comment

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

The sometimes const and sometimes not syntax isn't really great (not your fault, mind you).

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes, I noticed this syntax quirk too. Hard to know what to do about it. In packages, it would be nice if all bindings at global scope were implicitly const by default. But for simple scripting that would be fairly horrible.

Copy link
Member

Choose a reason for hiding this comment

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

Could be a special property of Main? (Or some property that could be set on a module-by-module basis).

@andyferris
Copy link
Member

Travis errors are odd...

@andreasnoack andreasnoack changed the title Use new inner constructor and type declaration syntax and consequently drop 0.5 support. Use new inner constructor and type declaration syntax Feb 23, 2017
@@ -66,7 +66,7 @@ end
SMatrix{S1, S2, $T, L}(x)
end
end
typealias SMatrixNoType{S1, S2, L, T} SMatrix{S1, S2, T, L}
@compat SMatrixNoType{S1, S2, L, T} = SMatrix{S1, S2, T, L}
Copy link
Member

Choose a reason for hiding this comment

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

I don't know why, but I don't remember this existing, which is why I couldn't fathom the test failure... In theory, MMatrix should be symmetric. But don't worry about this for this PR.

@andreasnoack
Copy link
Member Author

On 0.6, there seems to be an issue with @inferred and dot broadcast syntax. Looking into it now.

@andyferris
Copy link
Member

I made an issue for that

@andyferris
Copy link
Member

JuliaLang/julia#20620

@andreasnoack
Copy link
Member Author

andreasnoack commented Feb 23, 2017

Oh, I missed that one. I think there is an easy fix. This was the first time I've looked at the dot syntax expression representation. A fix is more complicated than anticipated.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 71.417% when pulling 4f578ff on andreasnoack:master into e6d7387 on JuliaArrays:master.

@andyferris andyferris merged commit e24e1d8 into JuliaArrays:master Feb 23, 2017
@andyferris
Copy link
Member

I just merged this, Andreas. I still plan to remove Compat and v0.5 support sometime soonish.

@andreasnoack
Copy link
Member Author

Could you make a release first?

@c42f
Copy link
Member

c42f commented Feb 27, 2017

Yes, let's make a release before we break everything with #113 (I guess this will end up dropping 0.5 support... honestly I was hoping to last a little longer!)

@andyferris
Copy link
Member

I was wondering who the target audience was? There is no functional changes for v0.5 users and v0.6 users will be using quite a different codebase soon... @andreasnoack is using master for v0.6 development reasonable for the time-being?

@andreasnoack
Copy link
Member Author

Using a release is slightly simpler in a larger group of collaborators but the main reason is Travis testing where it is pretty inconvenient to use master.

@andyferris
Copy link
Member

Yes, Travis. That makes sense.

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.

5 participants