Skip to content

Feature/proper result type#11

Closed
iv461 wants to merge 8 commits intodevelopfrom
feature/proper_result_type
Closed

Feature/proper result type#11
iv461 wants to merge 8 commits intodevelopfrom
feature/proper_result_type

Conversation

@iv461
Copy link
Owner

@iv461 iv461 commented Oct 27, 2025

I've fixed the issue that the result type had three states: value, error or none. Since the result type is used in the public API, users would have to handle the 'none' state as well. However, we guarantee that there will always be either a 'value' or an 'error', never 'none'. This guarantee should therefore also be reflected in the type. On the other hand, I actually need the three states for the promise state, because a promise might not have a value or error yet. Therefore, I actually need both a two-state type (a real result type, like C++23's std::expected/Rust's Result) for the public API, as well as a three-state type PromiseState for the promise.

iv461 and others added 6 commits August 27, 2025 22:20
* Fixed multiple things related to ownership and the usage of PIMPL: First, classes capturing the this-pointer should be non-copyable to prevent use-after-free bugs. Second, after they are non-copyable, users can't store them in the node-class, so a PIMPL-wrapper became necessary for the service client. Third, PIMPL-wrappers should generally mirror the impl-API, because there is no reason for arbitrary deviations. For this reason I added the promise-based functions into the impl-classes and the callback-based functions into the actual non-impl classes. Fourth, I decided on ownership semantics of the service client: No bookkeeping is provided for it since having a client without a handle to it is useless. PIMPL however is still useful to avoid users having to use shared pointers everywhere.

* Enabling nested coroutines (#9)

This fixes the promises and allows for nested coroutines. Also fixes the coroutine frame memory leaks.
…ince we use the result in the public API, this implies the user would have to handle the none state as well, but we actually guarantee that there is always either a value or error, never none. So this guarantee should be reflected in the type. On the other hand, I actually need the three states for the promise state, because a promise might not have anything yet. So I actually need a two-state type (a real result type, like std::expected and rust's Result) for the public API as well as a three-state PromiseState type for the promise.
@iv461 iv461 changed the base branch from main to develop October 27, 2025 16:57
@iv461 iv461 changed the base branch from develop to main October 27, 2025 16:59
@iv461 iv461 changed the base branch from main to develop October 27, 2025 17:01
@iv461 iv461 closed this Oct 30, 2025
@iv461 iv461 deleted the feature/proper_result_type branch October 30, 2025 14:48
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.

1 participant