On Tuesday, 12 July 2016 at 13:54:16 UTC, Lodovico Giaretta wrote:
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 08:52:26 UTC, Kagamin wrote:
Extract functions for shared parts:

void Do(string name)
{
    DoStuff();
    int i = find(name);
    DoStuffWithIndex(i);
}

void Do(int name)
{
    DoStuff();
    DoStuffWithIndex(i);
}

I don't like it, creates an extra function for no apparent reason except to get around the problem of not having a yield type of semantic. Again, I wasn't asking for any ol' solution, there are many ways to skin this cat.

It is usually considered a good thing to break big functions into smaller ones; this allows for easier code reading, better maintainability and easier reuse.

Doesn't matter, that isn't what I asked.

Also note that yield semantics as available in various languages is much different from what you are proposing here.

Not really. Yield is usually a break in flow, regardless just because it's applied to fibers doesn't mean it's *much* different. It's the same basic concept.





Reply via email to