-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Currently, the Transaction<T> class is generic and constrained to handle STM variables of a single type T per transaction. This design limits the ability to perform atomic operations across multiple STM variables of different types within the same transaction.
Problem
- Transactions cannot span variables of different types simultaneously (e.g., mixing
intandstringSTM variables in one atomic operation). - This restricts practical use cases where shared state is composed of heterogeneous types.
Proposed solution
- Remove the generic parameter
<T>from theTransactionclass, making it non-generic. - Adapt the internal data structures to hold STM variables of different types, possibly using a non-generic
ISTMVariableinterface or anobject-based approach. - Implement safe casting and type checking during read/write operations to maintain type safety at runtime.
Benefits
- Enables atomic transactions involving multiple STM variables of different types.
- Increases flexibility and expressiveness of STM operations.
- Aligns with common STM usage patterns where shared state is heterogeneous.
Considerations
- May introduce some overhead due to boxing/unboxing and runtime casts.
- Requires thorough testing to ensure type safety and performance are not adversely affected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request