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

n-ary transform function #121

Open
grisumbras opened this issue Apr 11, 2024 · 5 comments
Open

n-ary transform function #121

grisumbras opened this issue Apr 11, 2024 · 5 comments

Comments

@grisumbras
Copy link
Member

The way I see it, it should be something like system::invoke that invokes a callable with N (0+) arguments of which some can be results. In addition, for convenience it should invoke the callable similar to what std::invoke does.

Example

Foo
Processor::compose_abc(A const&, B const&, C const&);

system::result<Foo>
read_config(Processor& p, Config const& config)
{
    auto a = maybe_get_a(config);
    auto b = maybe_get_b(config);
    auto c = maybe_get_c(config);
    return system::invoke(&Processor::compose_abc, p, a, b, c);
}

One interesting question is whether result<void> arguments should be allowed. The semantics would be to ignore them when invoking the callable, but that would complicate implementation.

@pdimov
Copy link
Member

pdimov commented Apr 11, 2024

I assume the error types would need to match?

@grisumbras
Copy link
Member Author

Yes, definitely.

@pdimov
Copy link
Member

pdimov commented May 21, 2024

@grisumbras
Copy link
Member Author

Looks pretty good. It doesn't do the invoke thing that allows using pointers to members. Is that planned?

Also, I requested nullary function support, but now I don't remember what for.

@pdimov
Copy link
Member

pdimov commented May 21, 2024

Member function support is something I need to add to the "monadic" operators as well. I'll figure something out.

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

No branches or pull requests

2 participants