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

second phase of alphabet restructuring #943

Merged
merged 9 commits into from
May 10, 2019
Merged

second phase of alphabet restructuring #943

merged 9 commits into from
May 10, 2019

Conversation

h-2
Copy link
Member

@h-2 h-2 commented Apr 30, 2019

I have switched to a local fork to workaround USCiLab/cereal#565 for now.

Changes the alphabet related functions to be function objects. See also #869

I recommend reviewing on a commit-by-commit basis.

@marehr
Copy link
Member

marehr commented Apr 30, 2019

🚧 WIP 🚧 👷‍♂️ 👷‍♀️ 🏗️ 😆

@h-2 h-2 requested review from smehringer and eseiler and removed request for smehringer May 2, 2019 17:01
@h-2
Copy link
Member Author

h-2 commented May 3, 2019

@eseiler Can you review this? Thanks!

include/seqan3/core/char_operations/pretty_print.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
test/unit/alphabet/custom_alphabet_test.cpp Outdated Show resolved Hide resolved
Copy link
Member

@smehringer smehringer left a comment

Choose a reason for hiding this comment

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

first tiny look

include/seqan3/io/stream/parse_condition.hpp Show resolved Hide resolved
include/seqan3/core/char_operations/pretty_print.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
@h-2
Copy link
Member Author

h-2 commented May 3, 2019

I have added long(er) snippets to everything and addressed most of your points I think. I have also restructured the documentation for the customisation points a little so that it is hopefully more helpful. I have also added a second custom alphabet test that tests the "not-default-constructible" overloads (the nice adl-hack through associated namespaces of template args).

Also requested @rrahn for review.

If cereal does not react until Monday I will fork the repo and we need to discuss what to do before the release.

@h-2 h-2 requested a review from rrahn May 3, 2019 19:11
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
@h-2 h-2 force-pushed the alph_refac branch 2 times, most recently from 8576f1a to 32e2fb9 Compare May 6, 2019 10:17
@h-2 h-2 requested review from smehringer and eseiler and removed request for smehringer May 6, 2019 12:20
@codecov
Copy link

codecov bot commented May 7, 2019

Codecov Report

Merging #943 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #943      +/-   ##
==========================================
- Coverage   96.66%   96.64%   -0.02%     
==========================================
  Files         178      179       +1     
  Lines        6557     6528      -29     
==========================================
- Hits         6338     6309      -29     
  Misses        219      219
Impacted Files Coverage Δ
include/seqan3/io/stream/parse_condition.hpp 100% <ø> (ø) ⬆️
include/seqan3/io/stream/debug_stream.hpp 94.44% <ø> (ø) ⬆️
include/seqan3/alphabet/exception.hpp 100% <ø> (ø) ⬆️
include/seqan3/alphabet/detail/member_exposure.hpp 100% <ø> (ø) ⬆️
...nclude/seqan3/io/stream/parse_condition_detail.hpp 100% <ø> (ø) ⬆️
include/seqan3/alphabet/detail/alphabet_base.hpp 100% <ø> (ø) ⬆️
include/seqan3/alphabet/detail/alphabet_proxy.hpp 100% <ø> (ø) ⬆️
include/seqan3/alphabet/concept.hpp 100% <100%> (ø) ⬆️
...clude/seqan3/core/char_operations/pretty_print.hpp 100% <100%> (ø)
include/seqan3/alphabet/cigar/cigar_op.hpp 100% <100%> (ø) ⬆️
... and 8 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 c910631...281b8fb. Read the comment docs.

@h-2
Copy link
Member Author

h-2 commented May 7, 2019

I have DRYed a lot of the CPO-definitions so the number of added lines is reduces by about 400; there are no more "auxiliary concepts" and also no more free functions inside detail::adl::only. This required adding a small macro, though. Return types are now properly enforced and I fixed some smaller bugs, too.

Note that the CPOs are not in anonymous namespaces, because doxygen handles this really badly. It's not necessary though, unless we want to add friends to our own classes within namespace seqan3 that have the same names as the CPOs [we can just use members for this and friends of external types are handled correctly].

please give this a review soon everyone, thanks!

@h-2
Copy link
Member Author

h-2 commented May 7, 2019

The design in this file is based loosely on:

(the anonymous namespace and static hackery in the proposal are not necessary, because we have inline variables now)

Copy link
Member

@eseiler eseiler left a comment

Choose a reason for hiding this comment

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

First look

include/seqan3/core/detail/customisation_point.hpp Outdated Show resolved Hide resolved
include/seqan3/core/detail/customisation_point.hpp Outdated Show resolved Hide resolved
include/seqan3/core/metafunction/basic.hpp Outdated Show resolved Hide resolved
include/seqan3/core/metafunction/basic.hpp Outdated Show resolved Hide resolved
include/seqan3/core/metafunction/basic.hpp Outdated Show resolved Hide resolved
include/seqan3/core/metafunction/basic.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/adaptation/char.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/adaptation/char.hpp Show resolved Hide resolved
include/seqan3/alphabet/adaptation/uint.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Outdated Show resolved Hide resolved
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.

Some general questions to the code.

include/seqan3/alphabet/all.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
@@ -101,7 +102,7 @@ class parse_condition_base;
*
* \details
*
* The must be invocable with an seqan3::char_adaptation_concept type and supply a static constexpr `msg` member of type
* The must be invocable with an std::Integral type and supply a static constexpr `msg` member of type
Copy link
Contributor

Choose a reason for hiding this comment

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

The what?

Copy link
Member Author

Choose a reason for hiding this comment

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

not resolved?

seqan3::dna5 d2 = seqan3::assign_rank_to(2, seqan3::dna5{});

// too-large ranks are undefined behaviour:
seqan3::dna5 d3 = seqan3::assign_rank_to(50, seqan3::dna5{}); // 💣💥
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not use 💣 💥 in comments.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why not? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

hm, ok 😿

}
}

}
Copy link
Contributor

Choose a reason for hiding this comment

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

// my_namespace

Copy link
Member Author

Choose a reason for hiding this comment

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

not resolved?

}
}

}
Copy link
Contributor

Choose a reason for hiding this comment

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

// my_namespace

Copy link
Member Author

Choose a reason for hiding this comment

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

not resolved?

@h-2
Copy link
Member Author

h-2 commented May 8, 2019

But it is not resolved.

I can't reply to that inline :| I don't understand what you mean. Because I say "alphabet object"? I have already removed the requirement for the concept... What else would you call it? This is as "correct" as is understandable for the general use-case I think.

The only 100% formally correct description would be "Assign an object of type alphabet_rank_t<your_type> to your type where your_type is a type that provides one of three overloads described below".
That would make very poor UX I think. 99.99% of the time people will look at this documentation item they want to call assign_rankt_to on an existing alphabet.

@h-2 h-2 requested review from rrahn and eseiler and removed request for eseiler May 8, 2019 15:33
@h-2
Copy link
Member Author

h-2 commented May 8, 2019

I have updated the PR. There is some weird failure in an entirely unrelated alignment snippet, I really don't know what's going on. Apparantly it's trying to invoke to_char() with an operator& defined on ios
🤷‍♂️

any ideas someone?

@h-2
Copy link
Member Author

h-2 commented May 9, 2019

Another question that we can also discuss later is whether we want a general customisation namespace, e.g. seqan3::customisation which we use for customisation point implementations for types outside of seqan (built-in, std:: maybe) and as "upload" namespace ¹ in which people can provide specialisations for types outside of their namespaces.

This would mean renaming seqan3::adaptation to seqan3::customisation or seqan3::custom. I am in favour of this, but we can easily perform this change later, it will just change a few lines here.

¹ https://quuxplusone.github.io/blog/2018/03/19/customization-points-for-functions/

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.

I have some more small issues. I resolved all comments that have been addressed. Some were not.

include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
include/seqan3/alphabet/concept.hpp Show resolved Hide resolved
t && v, \
[[maybe_unused]] arg_ts && ... args) \
noexcept(noexcept(TERM)) \
requires requires (seqan3::detail::priority_tag<PRIO> const &, t && v, [[maybe_unused]] arg_ts && ... args) \
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why you need seqan3::detail::priority_tag<PRIO> const & in the requires clause.

Copy link
Member Author

Choose a reason for hiding this comment

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

good point

Copy link
Member Author

Choose a reason for hiding this comment

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

Wow, I have just reverted removing this, because it's the only way doxygen will accept the above code. Note that due to the macro I cannot put //!\cond blocks around the requires and /*\cond*/ does not work. Apparently the :: confuses Doxygen in that line so it stops parsing the rest of the line which makes everything work. If I remove the tag it somehow thinks the arguments to requires requires are variable definitions of type requires 🤷‍♂️

In any case I have reverted this and documented the hack.

* \tparam dependent_ts Any provided types are ignored.
*/
template <typename t, typename ...dependent_ts>
struct deferred_type
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that this should be public API. The use case is very special and would require at least a snippet to get the idea. Instead I would put it into detail and maybe even in the adl stuff/customisation point stuff.

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 can think of other places where this could be useful, but I can also move it to detail, if you prefer.

seqan3::dna5 d2 = seqan3::assign_rank_to(2, seqan3::dna5{});

// too-large ranks are undefined behaviour:
// seqan3::dna5 d3 = seqan3::assign_rank_to(50, seqan3::dna5{}); // 💣💥
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please remove 💣 💥 from the comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

So sad.

@h-2
Copy link
Member Author

h-2 commented May 9, 2019

There is some weird failure in an entirely unrelated alignment snippet, I really don't know what's going on.

@rrahn did you have a look at this? Do you have a clue whats going on?

@h-2
Copy link
Member Author

h-2 commented May 10, 2019

@rrahn did you have a look at this? Do you have a clue whats going on?

I have a workaround that can hopefully be reverted once the alphabet concepts are split with the next PR.

@h-2
Copy link
Member Author

h-2 commented May 10, 2019

I have a workaround that can hopefully be reverted once the alphabet concepts are split with the next PR.

I have found a more permanent fix to the problem that makes the workaround obsolete.

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

@h-2 h-2 removed the request for review from smehringer May 10, 2019 17:42
@h-2 h-2 merged commit e607fd3 into seqan:master May 10, 2019
@h-2 h-2 deleted the alph_refac branch May 10, 2019 19:23
@h-2 h-2 mentioned this pull request May 16, 2019
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