Skip to content

Define convert #504

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

Merged
merged 3 commits into from
Aug 27, 2018
Merged

Define convert #504

merged 3 commits into from
Aug 27, 2018

Conversation

blegat
Copy link
Member

@blegat blegat commented Aug 26, 2018

It will be quite hard to implement MOI.get(::OptimizerType, ::ObjectiveFunction{T}) passing the unit test added in #502 without the convert functions added in this PR.

The two conversions that were present in MOIU were moved to MOI as they do not add utilites but rather define constructor of MOI types.

@blegat blegat added this to the 0.6.0 milestone Aug 26, 2018

# Define shortcuts for
# SingleVariable -> ScalarAffineFunction
function ScalarAffineFunction{T}(f::SingleVariable) where T
Copy link
Member

Choose a reason for hiding this comment

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

Is it still Julia convention (post-1.0) to add constructor methods for conversions like this?

Copy link
Member Author

@blegat blegat Aug 26, 2018

Choose a reason for hiding this comment

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

If I understand correctly, since constructors are the low level functions for building objects, convert should redirect to constructors not the opposite. See https://discourse.julialang.org/t/recommended-style-for-conversion-vs-constructors-in-v0-7/11561/5

@mlubin
Copy link
Member

mlubin commented Aug 26, 2018

Please fix the CI failure before merging.

@codecov-io
Copy link

codecov-io commented Aug 26, 2018

Codecov Report

Merging #504 into master will increase coverage by 3.53%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #504      +/-   ##
==========================================
+ Coverage   95.39%   98.92%   +3.53%     
==========================================
  Files          46       43       -3     
  Lines        4694     3828     -866     
==========================================
- Hits         4478     3787     -691     
+ Misses        216       41     -175
Impacted Files Coverage Δ
src/Utilities/functions.jl 98.06% <ø> (+1.17%) ⬆️
src/functions.jl 100% <100%> (ø) ⬆️
src/Test/UnitTests/objectives.jl 100% <100%> (+1.4%) ⬆️
src/Utilities/model.jl 100% <100%> (+1.7%) ⬆️
src/Test/UnitTests/basic_constraint_tests.jl 96% <0%> (-2.08%) ⬇️
src/Test/contlinear.jl 98.32% <0%> (-1.68%) ⬇️
src/Test/config.jl 90.9% <0%> (-0.76%) ⬇️
src/attributes.jl 95.91% <0%> (-0.75%) ⬇️
src/Bridges/detbridge.jl 98.07% <0%> (-0.69%) ⬇️
src/Utilities/parser.jl 97.11% <0%> (-0.55%) ⬇️
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b237a3...22bacab. Read the comment docs.

@blegat blegat merged commit 5b9e114 into master Aug 27, 2018
@blegat blegat deleted the bl/convert branch August 28, 2018 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants