Skip to content

Commit

Permalink
Remove deprecated stuff (#542)
Browse files Browse the repository at this point in the history
This builds on PRs #538 and #539 to remove the concept of "untyped" _Senders_ and thus stop calling any _Senders_ "typed" (they're all typed).
 - #539 made `typed_sender<S>` an alias for `sender<S>` so now I can replace all uses of `typed_sender<>` with `sender<>` and deprecate `typed_sender<>`.
 - In the same spirit as #539, there's no need to refer to bulk _Senders_ as "typed" so I've renamed `typed_bulk_sender<>` to `bulk_sender<>` and deprecated `typed_bulk_sender<>`.
 - There's no need to call it `typed_via()` so `via()` now means what `typed_via()` meant and we retain `typed_via()` as a deprecated alias for `via()`.
 - Similarly for `typed_via_stream()`, `via_stream()` now means what `typed_via_stream()` meant and we retain `typed_via_stream()` as a deprecated alias for `via_stream()`.
 - I'm also deleting three things from `sender_concepts.hpp` that have been deprecated for a long time.
  • Loading branch information
ispeters authored Jul 3, 2023
1 parent 5668f26 commit 4dfd3a2
Show file tree
Hide file tree
Showing 36 changed files with 220 additions and 181 deletions.
6 changes: 3 additions & 3 deletions doc/api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ using callback_t = void(void* /*context*/, int /*result*/);
void old_c_style_api(int a, int b, void* context, callback_t* callback_fn);

// A sender-based async API implemented in terms of the C-style API (using C++20):
unifex::typed_sender auto new_sender_api(int a, int b) {
unifex::sender auto new_sender_api(int a, int b) {
return unifex::create<int>([=](auto& rec) {
old_c_style_api(a, b, &rec, [](void* context, int result) {
unifex::void_cast<decltype(rec)>(context).set_value(result);
Expand Down Expand Up @@ -701,7 +701,7 @@ value channel as an empty `std::optional`. The value channel is also converted
into an optional. The result is a sender that never completes with done,
reporting cancellation by completing with an empty optional.

This function only accepts `typed_sender`s that complete with either
This function only accepts `sender`s that complete with either
`void` or a single type.

For example:
Expand Down Expand Up @@ -1172,7 +1172,7 @@ auto&& [state...] =
**Arguments:**
The first argument to `at_coroutine_exit` is a callable that returns an awaitable type
(e.g., a `unifex::task<>` or a type that satisfies the `typed_sender` concept).
(e.g., a `unifex::task<>` or a type that satisfies the `sender` concept).
The other arguments are optional state that may be needed by the cleanup action. The
cleanup action assumes ownership of the passed-in state by copying the state into separate
Expand Down
2 changes: 1 addition & 1 deletion examples/coroutine_stream_consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <unifex/take_until.hpp>
#include <unifex/task.hpp>
#include <unifex/timed_single_thread_context.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>
#include <unifex/let_done.hpp>
#include <unifex/then.hpp>
#include <unifex/just.hpp>
Expand Down
2 changes: 1 addition & 1 deletion examples/delayed_stream_cancellation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <unifex/range_stream.hpp>
#include <unifex/sync_wait.hpp>
#include <unifex/timed_single_thread_context.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>
#include <unifex/scheduler_concepts.hpp>
#include <unifex/then.hpp>
#include <unifex/stop_when.hpp>
Expand Down
4 changes: 2 additions & 2 deletions examples/for_each_via_thread_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <unifex/sync_wait.hpp>
#include <unifex/then.hpp>
#include <unifex/transform_stream.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>

#include <cstdio>

Expand All @@ -30,7 +30,7 @@ int main() {

sync_wait(then(
for_each(
typed_via_stream(
via_stream(
context.get_scheduler(),
transform_stream(
range_stream{0, 10},
Expand Down
4 changes: 2 additions & 2 deletions examples/for_each_via_trampoline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <unifex/trampoline_scheduler.hpp>
#include <unifex/then.hpp>
#include <unifex/transform_stream.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>

#include <cstdio>

Expand All @@ -28,7 +28,7 @@ using namespace unifex;
int main() {
sync_wait(then(
for_each(
typed_via_stream(
via_stream(
trampoline_scheduler{},
transform_stream(
range_stream{0, 10},
Expand Down
6 changes: 3 additions & 3 deletions examples/fp_delegation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <unifex/sync_wait.hpp>
#include <unifex/timed_single_thread_context.hpp>
#include <unifex/transform_stream.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>
#include <unifex/with_query_value.hpp>

#include <atomic>
Expand Down Expand Up @@ -191,10 +191,10 @@ int main() {
sync_wait(
then(
for_each(
typed_via_stream(
via_stream(
outer_delegating_ctx.get_scheduler(),
transform_stream(
typed_via_stream(
via_stream(
inner_delegating_ctx.get_scheduler(),
transform_stream(
range_stream{0, 10},
Expand Down
4 changes: 2 additions & 2 deletions examples/get_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <unifex/sync_wait.hpp>
#include <unifex/timed_single_thread_context.hpp>
#include <unifex/transform_stream.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>
#include <unifex/with_query_value.hpp>

#include <chrono>
Expand All @@ -45,7 +45,7 @@ int main() {
// composed operations.
sync_wait(with_query_value(
then(
for_each(typed_via_stream(current_scheduler,
for_each(via_stream(current_scheduler,
transform_stream(range_stream{0, 10},
[](int value) {
return value * value;
Expand Down
6 changes: 3 additions & 3 deletions examples/linux/io_epoll_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <unifex/then.hpp>
#include <unifex/when_all.hpp>
#include <unifex/repeat_effect_until.hpp>
#include <unifex/typed_via.hpp>
#include <unifex/via.hpp>
#include <unifex/with_query_value.hpp>
#include <unifex/let_done.hpp>
#include <unifex/stop_when.hpp>
Expand Down Expand Up @@ -113,7 +113,7 @@ int main() {
++reps;
});
})
| typed_via(scheduler)
| via(scheduler)
// Repeat the reads:
| repeat_effect()
// stop reads after requested time
Expand All @@ -129,7 +129,7 @@ int main() {
sequence(
just_from([&]{ printf("writes starting!\n"); }),
defer([&, databuffer] { return discard(async_write_some(wPipeRef, databuffer)); })
| typed_via(scheduler)
| via(scheduler)
| repeat_effect()
| let_done([]{return just();})
| with_query_value(get_stop_token, stopToken),
Expand Down
4 changes: 2 additions & 2 deletions examples/produce_on_consume_via.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <unifex/sync_wait.hpp>
#include <unifex/then.hpp>
#include <unifex/transform_stream.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>

#include <cstdio>

Expand All @@ -32,7 +32,7 @@ int main() {

sync_wait(then(
for_each(
typed_via_stream(
via_stream(
context1.get_scheduler(),
on_stream(
context2.get_scheduler(),
Expand Down
4 changes: 2 additions & 2 deletions examples/reduce_with_trampoline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <unifex/trampoline_scheduler.hpp>
#include <unifex/then.hpp>
#include <unifex/transform_stream.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>

#include <cstdio>

Expand All @@ -31,7 +31,7 @@ using namespace unifex;
int main() {
sync_wait(then(
reduce_stream(
typed_via_stream(
via_stream(
trampoline_scheduler{},
transform_stream(
range_stream{0, 100'000},
Expand Down
2 changes: 1 addition & 1 deletion examples/stop_immediately.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <unifex/stop_immediately.hpp>
#include <unifex/take_until.hpp>
#include <unifex/thread_unsafe_event_loop.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>

#include <chrono>
#include <cstdio>
Expand Down
4 changes: 2 additions & 2 deletions examples/type_erased_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <unifex/sync_wait.hpp>
#include <unifex/then.hpp>
#include <unifex/transform_stream.hpp>
#include <unifex/typed_via_stream.hpp>
#include <unifex/via_stream.hpp>

#include <cstdio>

Expand All @@ -34,7 +34,7 @@ int main() {
sync_wait(then(
for_each(
type_erase<int>(
typed_via_stream(
via_stream(
context1.get_scheduler(),
on_stream(
context2.get_scheduler(),
Expand Down
4 changes: 2 additions & 2 deletions include/unifex/bulk_join.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _join_sender<Source>::type {
struct _fn {
template(typename Source)
(requires
typed_bulk_sender<Source> &&
bulk_sender<Source> &&
tag_invocable<_fn, Source>)
auto operator()(Source&& source) const
noexcept(is_nothrow_tag_invocable_v<_fn, Source>)
Expand All @@ -148,7 +148,7 @@ struct _fn {

template(typename Source)
(requires
typed_bulk_sender<Source> &&
bulk_sender<Source> &&
(!tag_invocable<_fn, Source>))
auto operator()(Source&& source) const
noexcept(std::is_nothrow_constructible_v<remove_cvref_t<Source>, Source>)
Expand Down
6 changes: 3 additions & 3 deletions include/unifex/bulk_transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class _tfx_sender<Source, Func, Policy>::type {

struct _fn {
template(typename Source, typename Func, typename FuncPolicy = decltype(get_execution_policy(UNIFEX_DECLVAL(Func&))))
(requires typed_bulk_sender<Source>)
(requires bulk_sender<Source>)
auto operator()(Source&& s, Func&& f) const
noexcept(is_nothrow_callable_v<_fn, Source, Func, FuncPolicy>)
-> callable_result_t<_fn, Source, Func, FuncPolicy> {
Expand All @@ -215,7 +215,7 @@ struct _fn {

template(typename Source, typename Func, typename FuncPolicy)
(requires
typed_bulk_sender<Source> AND
bulk_sender<Source> AND
tag_invocable<_fn, Source, Func, FuncPolicy>)
auto operator()(Source&& s, Func&& f, FuncPolicy policy) const
noexcept(is_nothrow_tag_invocable_v<_fn, Source, Func, FuncPolicy>)
Expand All @@ -225,7 +225,7 @@ struct _fn {

template(typename Source, typename Func, typename FuncPolicy)
(requires
typed_bulk_sender<Source> AND
bulk_sender<Source> AND
(!tag_invocable<_fn, Source, Func, FuncPolicy>))
auto operator()(Source&& s, Func&& f, FuncPolicy policy) const
noexcept(
Expand Down
2 changes: 1 addition & 1 deletion include/unifex/create.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ struct _fn {
* void old_c_style_api(int a, int b, void* context, callback_t* callback_fn);
*
* // A sender-based async API implemented in terms of the C-style API (using C++20):
* unifex::typed_sender auto new_sender_api(int a, int b) {
* unifex::sender auto new_sender_api(int a, int b) {
* return unifex::create<int>([=](auto& rec) {
* old_c_style_api(a, b, &rec, [](void* context, int result) {
* unifex::void_cast<decltype(rec)>(context).set_value(result);
Expand Down
2 changes: 1 addition & 1 deletion include/unifex/done_as_optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace _done_as_opt {
namespace _cpo {
inline const struct _fn {
template(typename Sender) //
(requires _single_typed_sender<Sender>) //
(requires _single_sender<Sender>) //
auto operator()(Sender&& predecessor) const {
using optional_t = std::optional<
non_void_t<std::decay_t<sender_single_value_return_type_t<Sender>>>>;
Expand Down
8 changes: 4 additions & 4 deletions include/unifex/nest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ inline const struct _nest_fn final {

public:
template(typename Sender, typename Scope) //
(requires typed_sender<Sender> AND tag_invocable<_nest_fn, Sender, Scope&>
AND typed_sender<tag_invoke_result_t<_nest_fn, Sender, Scope&>>) //
(requires sender<Sender> AND tag_invocable<_nest_fn, Sender, Scope&>
AND sender<tag_invoke_result_t<_nest_fn, Sender, Scope&>>) //
auto
operator()(Sender&& sender, Scope& scope) const
noexcept(is_nothrow_tag_invocable_v<_nest_fn, Sender, Scope&>)
Expand All @@ -50,9 +50,9 @@ inline const struct _nest_fn final {
}

template(typename Sender, typename Scope) //
(requires typed_sender<Sender> AND(
(requires sender<Sender> AND(
!tag_invocable<_nest_fn, Sender, Scope&>)
AND typed_sender<nest_member_result_t<Scope, Sender>>) //
AND sender<nest_member_result_t<Scope, Sender>>) //
auto
operator()(Sender&& sender, Scope& scope) const
noexcept(is_nest_member_nothrow_v<Scope, Sender>)
Expand Down
Loading

0 comments on commit 4dfd3a2

Please sign in to comment.