From 85bdfdff5b523a1f2cecd7f8fb2a9bba67a2b365 Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Mon, 5 Oct 2026 01:11:04 +0200 Subject: [PATCH] refactor!: prefix `AwaitOperationConfiguration` cases with `Await` Unqualified cases such as `Parallel 4` collided with `System.Threading.Tasks.Parallel` (FS1133) whenever that namespace was opened after `FSharp.Control.R3`. The `Await` prefix mirrors the `Chunk` prefix of `ChunkConfiguration` and removes the collision. BREAKING CHANGE: `Sequential`, `Drop`, `Switch`, `Parallel`, `SequentialParallel` and `ThrottleFirstLast` become `AwaitSequential`, `AwaitDrop`, `AwaitSwitch`, `AwaitParallel`, `AwaitSequentialParallel` and `AwaitThrottleFirstLast`. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 +++ src/FSharp.Control.R3/ProcessingOptions.fs | 47 +++++++++++++--------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf08e0..6583e86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- **Breaking:** `AwaitOperationConfiguration` cases are prefixed with `Await` (`AwaitSequential`, `AwaitParallel 4`, ...) so they no longer collide with `System.Threading.Tasks.Parallel` + ## [0.3.1] - 2026-01-28 ### Fixed diff --git a/src/FSharp.Control.R3/ProcessingOptions.fs b/src/FSharp.Control.R3/ProcessingOptions.fs index 0de9e72..a868b18 100644 --- a/src/FSharp.Control.R3/ProcessingOptions.fs +++ b/src/FSharp.Control.R3/ProcessingOptions.fs @@ -5,23 +5,30 @@ open System.Threading open System.Threading.Tasks open R3 +/// +/// Defines how an asynchronous selector processes source elements that arrive while a previous invocation is still running. +/// +/// The cases carry the Await prefix so that they never collide with other names opened next to +/// , such as . +/// +/// type AwaitOperationConfiguration = /// All values are queued, and the next value waits for the completion of the asynchronous method. - | Sequential + | AwaitSequential /// Drop new value when async operation is running. - | Drop + | AwaitDrop /// If the previous asynchronous method is running, it is cancelled and the next asynchronous method is executed. - | Switch + | AwaitSwitch /// All values are sent immediately to the asynchronous method. - | Parallel of + | AwaitParallel of /// If set to -1, there is no limit. MaxConcurrent : int /// All values are sent immediately to the asynchronous method, but the results are queued and passed to the next operator in order. - | SequentialParallel of + | AwaitSequentialParallel of /// If set to -1, there is no limit. MaxConcurrent : int /// Send the first value and the last value while the asynchronous method is running. - | ThrottleFirstLast + | AwaitThrottleFirstLast type ProcessingOptions = { AwaitOperationConfiguration : AwaitOperationConfiguration @@ -30,13 +37,13 @@ type ProcessingOptions = { } with static let ``default`` = { - AwaitOperationConfiguration = AwaitOperationConfiguration.Sequential + AwaitOperationConfiguration = AwaitOperationConfiguration.AwaitSequential ConfigureAwait = true CancelOnCompleted = false } static let ``parallel`` = { - AwaitOperationConfiguration = AwaitOperationConfiguration.Parallel -1 + AwaitOperationConfiguration = AwaitOperationConfiguration.AwaitParallel -1 ConfigureAwait = true CancelOnCompleted = false } @@ -46,21 +53,21 @@ type ProcessingOptions = { member this.MaxConcurrent = match this.AwaitOperationConfiguration with - | AwaitOperationConfiguration.Sequential -> -1 - | AwaitOperationConfiguration.Drop -> -1 - | AwaitOperationConfiguration.Switch -> -1 - | AwaitOperationConfiguration.Parallel maxConcurrent -> maxConcurrent - | AwaitOperationConfiguration.SequentialParallel maxConcurrent -> maxConcurrent - | AwaitOperationConfiguration.ThrottleFirstLast -> -1 + | AwaitOperationConfiguration.AwaitSequential -> -1 + | AwaitOperationConfiguration.AwaitDrop -> -1 + | AwaitOperationConfiguration.AwaitSwitch -> -1 + | AwaitOperationConfiguration.AwaitParallel maxConcurrent -> maxConcurrent + | AwaitOperationConfiguration.AwaitSequentialParallel maxConcurrent -> maxConcurrent + | AwaitOperationConfiguration.AwaitThrottleFirstLast -> -1 member this.AwaitOperation = match this.AwaitOperationConfiguration with - | AwaitOperationConfiguration.Sequential -> AwaitOperation.Sequential - | AwaitOperationConfiguration.Drop -> AwaitOperation.Drop - | AwaitOperationConfiguration.Switch -> AwaitOperation.Switch - | AwaitOperationConfiguration.Parallel _ -> AwaitOperation.Parallel - | AwaitOperationConfiguration.SequentialParallel _ -> AwaitOperation.SequentialParallel - | AwaitOperationConfiguration.ThrottleFirstLast -> AwaitOperation.ThrottleFirstLast + | AwaitOperationConfiguration.AwaitSequential -> AwaitOperation.Sequential + | AwaitOperationConfiguration.AwaitDrop -> AwaitOperation.Drop + | AwaitOperationConfiguration.AwaitSwitch -> AwaitOperation.Switch + | AwaitOperationConfiguration.AwaitParallel _ -> AwaitOperation.Parallel + | AwaitOperationConfiguration.AwaitSequentialParallel _ -> AwaitOperation.SequentialParallel + | AwaitOperationConfiguration.AwaitThrottleFirstLast -> AwaitOperation.ThrottleFirstLast type ChunkConfiguration<'T> = | ChunkCount of WindowLength : int