Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #81453

Re: "C++20 Coroutines" by Martin Bond

From HorseyWorsey@the_stables.com
Newsgroups comp.lang.c++
Subject Re: "C++20 Coroutines" by Martin Bond
Date 2021-09-23 09:14 +0000
Organization Aioe.org NNTP Server
Message-ID <sihgia$cl8$1@gioia.aioe.org> (permalink)
References (1 earlier) <sic9jh$bo0$1@gioia.aioe.org> <sicu8j$qg5$1@gioia.aioe.org> <sieejh$1am$1@gioia.aioe.org> <siesre$171$1@gioia.aioe.org> <sihb4s$1s8m$1@gioia.aioe.org>

Show all headers | View raw


On Thu, 23 Sep 2021 07:42:22 -0000 (UTC)
Juha Nieminen <nospam@thanks.invalid> wrote:
>HorseyWorsey@the_stables.com wrote:
>> On Wed, 22 Sep 2021 05:22:59 -0000 (UTC)
>> Juha Nieminen <nospam@thanks.invalid> wrote:
>>>You *can* achieve the same effect as coroutines without them, but it
>>>requires you to manually create the data containers where all the
>>>necessary variables are stored so that execution can continue from
>>>the point where it left, and you have to manually create jump statements
>> 
>> Isn't that the point of class methods and variables? Ie: Black boxing state.
>
>I don't understand what that has anything to do with what I wrote.
>
>Classes don't remove the need to manually write them, with all the
>variables necessary to retain state, as said.

Where did I say they did? I'm saying the point of them is to black box state,
not that it doesn't require any effort to attain that.

>> Having multiple yield points sounds like asking for sphagetti code.
>
>No, yielding precisely *avoids* spaghetti code, because the complexity
>is taken care by the compiler rather than explicitly by your code.
>You won't have large switch blocks or chained ifs, with gotos or
>function calls in each branch, nor separate classes or structs containing
>the state of the function. Instead of all that, you have a single
>'yield' at every location where you need to return to the caller. After
>that the execution continues from there as if nothing had happened.

Oh sure, just do a co_call or co_resume, obvious where it'll go. Not. Its
a magical mystery tour of the code dependent on the stack. At least state
machines are explicit.

>*Significantly* simpler.

Syntatically maybe.

>> Hmm, not convinced thats any simpler than using object or global state.
>
>So you think that a couple of 'yield' instructions here and there is
>not any simpler than having to have some class or struct containing the
>state of the decompresser, and some chained if, or a switch block, that
>jumps wherever the processing was going on at that moment, based on those
>state variables?

Yes.

>In that case, I don't know what to say.

Good, say nothing. We'll just have to disagree.

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

"C++20 Coroutines" by Martin Bond Lynn McGuire <lynnmcguire5@gmail.com> - 2021-09-20 16:30 -0500
  Re: "C++20 Coroutines" by Martin Bond Bo Persson <bo@bo-persson.se> - 2021-09-21 09:28 +0200
  Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-21 11:45 +0200
    Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-21 15:37 +0000
      Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-21 17:40 +0200
      Re: "C++20 Coroutines" by Martin Bond Juha Nieminen <nospam@thanks.invalid> - 2021-09-22 05:22 +0000
        Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-22 09:26 +0000
          Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-22 16:40 +0200
            Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-22 15:01 +0000
              Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-23 05:38 +0200
                Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-23 09:05 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-24 18:15 +0200
                Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 00:57 +0000
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-23 09:11 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-24 18:17 +0200
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 09:19 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 12:00 +0200
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 10:09 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 12:18 +0200
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 10:39 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 12:42 +0200
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 10:44 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 13:14 +0200
                Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 12:44 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 15:58 +0200
                Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 13:59 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 16:23 +0200
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-28 07:24 +0200
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 15:28 +0000
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 15:04 +0000
                Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 18:44 +0200
                Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-26 14:15 +0000
                Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 12:32 +0000
          Re: "C++20 Coroutines" by Martin Bond Juha Nieminen <nospam@thanks.invalid> - 2021-09-23 07:42 +0000
            Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-23 09:14 +0000
              Re: "C++20 Coroutines" by Martin Bond Juha Nieminen <nospam@thanks.invalid> - 2021-09-24 04:42 +0000
            Re: "C++20 Coroutines" by Martin Bond Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-24 18:19 +0200
              Re: "C++20 Coroutines" by Martin Bond Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-09-24 21:07 +0100
                Re: "C++20 Coroutines" by Martin Bond Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-06 13:19 -0700
              Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 00:58 +0000
                Re: "C++20 Coroutines" by Martin Bond Juha Nieminen <nospam@thanks.invalid> - 2021-09-27 05:39 +0000
                Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-29 02:30 +0000
              Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 09:20 +0000
        Re: "C++20 Coroutines" by Martin Bond "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-22 11:31 +0200
      Re: "C++20 Coroutines" by Martin Bond Sam <sam@email-scan.com> - 2021-09-22 18:43 -0400
        Re: "C++20 Coroutines" by Martin Bond Juha Nieminen <nospam@thanks.invalid> - 2021-09-23 07:45 +0000
          Re: "C++20 Coroutines" by Martin Bond "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-23 01:53 -0700
          Re: "C++20 Coroutines" by Martin Bond Sam <sam@email-scan.com> - 2021-09-24 19:21 -0400
            Re: "C++20 Coroutines" by Martin Bond HorseyWorsey@the_stables.com - 2021-09-25 09:28 +0000
              Re: "C++20 Coroutines" by Martin Bond Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 12:38 +0000
            Re: "C++20 Coroutines" by Martin Bond Juha Nieminen <nospam@thanks.invalid> - 2021-09-27 05:42 +0000
  Re: "C++20 Coroutines" by Martin Bond "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-25 15:14 +0200
    Re: "C++20 Coroutines" by Martin Bond Manfred <noname@add.invalid> - 2021-09-25 23:07 +0200
      Re: "C++20 Coroutines" by Martin Bond "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-26 01:50 +0200
        Re: "C++20 Coroutines" by Martin Bond Manfred <noname@add.invalid> - 2021-09-26 19:12 +0200

csiph-web