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

Rename concepts to be standard conform #1860

Merged
merged 8 commits into from
Jun 5, 2020

Conversation

wvdtoorn
Copy link
Contributor

@wvdtoorn wvdtoorn commented May 29, 2020

Fixes part of seqan/product_backlog#49.

Renaming the stuff that was renamed by the standard or was in the wrong namespace.

  • std::default_constructible -> std::default_initializable
  • std::readable -> std::indirectly_readable
  • std::writable -> std::indirectly_writable
  • std::back_inserter -> std::cpp20::back_inserter (back_inserter has a new behaviour since cxx20; it is default initializable)
  • std::ranges::default_sentinel -> std::default_sentinel (we wrongly assume that these are in std::ranges namespace, even though they are in std namespace)
  • std::ranges::default_sentinel_t -> std::default_sentinel_t (we wrongly assume that these are in std::ranges namespace, even though they are in std namespace)
  • std::ranges::all_view -> std::views::all_t

@wvdtoorn wvdtoorn requested review from a team and simonsasse and removed request for a team May 29, 2020 05:23
@wvdtoorn wvdtoorn force-pushed the rename_deprecated_concepts branch 2 times, most recently from 907a290 to 3c773c3 Compare June 2, 2020 07:08
@codecov
Copy link

codecov bot commented Jun 2, 2020

Codecov Report

Merging #1860 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1860   +/-   ##
=======================================
  Coverage   97.62%   97.62%           
=======================================
  Files         250      250           
  Lines        9507     9507           
=======================================
  Hits         9281     9281           
  Misses        226      226           
Impacted Files Coverage Δ
...e/algorithm/detail/algorithm_executor_blocking.hpp 100.00% <ø> (ø)
include/seqan3/core/detail/pack_algorithm.hpp 100.00% <ø> (ø)
...clude/seqan3/io/alignment_file/format_sam_base.hpp 98.58% <ø> (ø)
include/seqan3/io/alignment_file/input.hpp 100.00% <ø> (ø)
include/seqan3/io/alignment_file/output.hpp 100.00% <ø> (ø)
include/seqan3/io/sequence_file/format_fasta.hpp 97.29% <ø> (ø)
include/seqan3/io/sequence_file/format_fastq.hpp 98.41% <ø> (ø)
include/seqan3/io/sequence_file/input.hpp 100.00% <ø> (ø)
include/seqan3/io/sequence_file/output.hpp 100.00% <ø> (ø)
include/seqan3/io/structure_file/input.hpp 100.00% <ø> (ø)
... and 31 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 c84a1ad...fd018ba. Read the comment docs.

Copy link
Member

@simonsasse simonsasse left a comment

Choose a reason for hiding this comment

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

Just one question for my understanding and a small commit thing. :)

@@ -378,6 +372,17 @@ template < class T >
SEQAN3_CONCEPT default_constructible = constructible_from<T>;
Copy link
Member

Choose a reason for hiding this comment

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

I do not quite understand the reason why we define two times the same concept and name it differently (line 383). Is it so that the user can still use std::default_constructible ? How will this appear in the Documentation ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, you are completely right. This was incorrect and slipped through. Fixed.

Copy link
Member

@simonsasse simonsasse Jun 2, 2020

Choose a reason for hiding this comment

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

Alright but is this correct: It does not matter wether I use the concept default_constructable or default_initializable ? Because line 383 says both concepts are equal right ?
Also the links lead to the same page:
https://en.cppreference.com/w/cpp/concepts/default_constructible
gets redirected to:
https://en.cppreference.com/w/cpp/concepts/default_initializable

Copy link
Contributor Author

@wvdtoorn wvdtoorn Jun 2, 2020

Choose a reason for hiding this comment

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

As is, correct.
@marehr What is your thought on this situation? Would it maybe be better, instead of adding the default_initializable concept like now, to do:

diff --git a/include/seqan3/std/concepts b/include/seqan3/std/concepts
index 112e7307..014a61de 100644
--- a/include/seqan3/std/concepts
+++ b/include/seqan3/std/concepts
@@ -361,17 +361,6 @@ template < class T, class... Args >
 SEQAN3_CONCEPT constructible_from = destructible<T> && std::is_constructible_v<T, Args...>;
 //!\endcond
 
-/*!\interface   std::default_constructible <>
- * \extends     std::constructible_from
- * \brief       The std::default_constructible concept provides a shorthand for the common case when the question is whether
- *              a type can be constructed with no arguments.
- * \sa          https://en.cppreference.com/w/cpp/concepts/default_constructible
- */
-//!\cond
-template < class T >
-SEQAN3_CONCEPT default_constructible = constructible_from<T>;
-//!\endcond
-
 /*!\interface   std::default_initializable <>
  * \extends     std::constructible_from
  * \brief       The std::default_initializable concept provides a shorthand for the common case when the question is whether
@@ -380,7 +369,7 @@ SEQAN3_CONCEPT default_constructible = constructible_from<T>;
  */
 //!\cond
 template < class T >
-SEQAN3_CONCEPT default_initializable = default_constructible<T>;
+SEQAN3_CONCEPT default_initializable = constructible_from<T>;
 //!\endcond
 
 /*!\interface   std::move_constructible <>

Copy link
Member

@marehr marehr Jun 2, 2020

Choose a reason for hiding this comment

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

This one should be removed :) and replaced with std::default_initializable

Good catch :)

Copy link
Member

Choose a reason for hiding this comment

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

Oh @wvandertoorn your patch already expressed this :) Awesome :)

@@ -244,8 +244,6 @@ inline namespace deprecated
// // [default.sentinels], default sentinels
// struct default_sentinel_t;
// inline constexpr default_sentinel_t default_sentinel{};
using ::std::default_sentinel_t;
Copy link
Member

@simonsasse simonsasse Jun 2, 2020

Choose a reason for hiding this comment

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

This line should maybe better be removed in the previous commit (7a241a9) , not sure though. 🧐

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely, changed it.

Copy link
Member

@simonsasse simonsasse left a comment

Choose a reason for hiding this comment

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

Looks good ! 👌

@wvdtoorn wvdtoorn requested review from a team and rrahn and removed request for a team June 2, 2020 15:19
Copy link
Contributor

@rrahn rrahn left a comment

Choose a reason for hiding this comment

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

lgtm
We should mention though in the changelog that the following changed in accordance with the standard: default_constructible -> default_initializable, readable -> indirectly_readable, writable -> indirectly_writable

@rrahn
Copy link
Contributor

rrahn commented Jun 2, 2020

Some more missing std::ranges::default_sentinel references:
/home/travis/build/seqan/seqan3/include/seqan3/range/views/minimiser.hpp:141:29: error: ‘default_sentinel’ is not a member of ‘std::ranges’

@wvdtoorn wvdtoorn force-pushed the rename_deprecated_concepts branch from 66e3283 to 3dcca4a Compare June 3, 2020 10:49
@wvdtoorn
Copy link
Contributor Author

wvdtoorn commented Jun 3, 2020

Some more missing std::ranges::default_sentinel references:
/home/travis/build/seqan/seqan3/include/seqan3/range/views/minimiser.hpp:141:29: error: ‘default_sentinel’ is not a member of ‘std::ranges’

Wow, that was some confusing rebase fuck-up, sorry.. Fixed and changelog entry added.

@wvdtoorn wvdtoorn requested a review from rrahn June 4, 2020 08:06
Copy link
Contributor

@rrahn rrahn left a comment

Choose a reason for hiding this comment

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

Just one more little change 👍

CHANGELOG.md Outdated Show resolved Hide resolved
@rrahn
Copy link
Contributor

rrahn commented Jun 4, 2020

Wow, that was some confusing rebase fuck-up, sorry.. Fixed and changelog entry added.

Well, that is what fun looks like 😆

@wvdtoorn wvdtoorn force-pushed the rename_deprecated_concepts branch from 02a5d73 to fd018ba Compare June 5, 2020 06:14
@wvdtoorn wvdtoorn requested a review from rrahn June 5, 2020 06:16
Copy link
Contributor

@rrahn rrahn left a comment

Choose a reason for hiding this comment

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

Lgtm, many thanks.

@rrahn rrahn merged commit cf2505c into seqan:master Jun 5, 2020
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.

None yet

4 participants