Skip to content

Commit bf440f6

Browse files
ocotsclaude
andcommitted
refactor: move NotProvided/NotProvidedType from Options to Core
NotProvidedType and NotProvided are now defined in CTBase.Core as the canonical ecosystem-wide sentinel. CTBase.Options re-exports both names unchanged — no user-visible API change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 581b424 commit bf440f6

6 files changed

Lines changed: 62 additions & 71 deletions

File tree

BREAKINGS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
This document outlines all breaking changes introduced in CTBase v0.18.0-beta compared to v0.17.4. Use this guide to migrate your code and understand the impact of these changes.
44

5+
## Non-breaking note (0.24.1-beta)
6+
7+
- **NotProvided moved to Core**: `NotProvidedType` and `NotProvided` are now defined in
8+
`CTBase.Core`; `CTBase.Options` re-exports them. All existing `CTBase.Options.NotProvided`
9+
and `using CTBase.Options` consumers continue to work unchanged.
10+
- `CTBase.Core.NotProvided` is now the canonical ecosystem-wide sentinel.
11+
512
## Non-breaking note (0.24.0-beta)
613

714
- **Differentiation module**: Added comprehensive AD backend infrastructure for computing gradients

CHANGELOGS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to CTBase will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.24.1-beta] - 2026-06-26
9+
10+
### 🔄 Refactoring
11+
12+
- **NotProvided moved to Core**: `NotProvidedType` and `NotProvided` are now defined in
13+
`CTBase.Core` instead of `CTBase.Options`. `CTBase.Options` re-exports both names
14+
unchanged — no user-visible API change.
15+
816
## [0.24.0-beta] - 2026-06-25
917

1018
### ✨ New Features

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "CTBase"
22
uuid = "54762871-cc72-4466-b8e8-f6c8b58076cd"
3-
version = "0.24.0-beta"
3+
version = "0.24.1-beta"
44
authors = ["Olivier Cots <olivier.cots@irit.fr>", "Jean-Baptiste Caillau <caillau@univ-cotedazur.fr>"]
55

66
[deps]

src/Core/Core.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import DocStringExtensions: TYPEDEF, TYPEDSIGNATURES
1313
include("types.jl")
1414
include("tags.jl")
1515
include("caches.jl")
16+
include("not_provided.jl")
1617
include("default.jl")
1718

1819
# Private utilities
@@ -27,6 +28,7 @@ include("display.jl")
2728
# Export public API
2829
export ctNumber, matrix2vec, to_out_of_place, make_coerce, @ensure
2930
export AbstractTag, AbstractCache
31+
export NotProvided, NotProvidedType
3032
export Style, Palette
3133
export DEFAULT_PALETTE, MONOCHROME_PALETTE, HIGH_CONTRAST_PALETTE
3234
export current_palette, set_palette!, set_color!, reset_palette!, show_palette

src/Core/not_provided.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
$(TYPEDEF)
3+
4+
Singleton type marking the absence of a provided value.
5+
6+
Ecosystem-wide sentinel for "no default / argument not given". The canonical
7+
value is [`NotProvided`](@ref).
8+
9+
See also: [`NotProvided`](@ref).
10+
"""
11+
struct NotProvidedType end
12+
13+
"""
14+
NotProvided
15+
16+
Singleton instance of [`NotProvidedType`](@ref).
17+
18+
The canonical "not provided" sentinel used across the control-toolbox ecosystem
19+
(option defaults, optional variable parameters, optional AD backends, …).
20+
21+
# Example
22+
```julia-repl
23+
julia> using CTBase.Core
24+
25+
julia> x = NotProvided
26+
NotProvided
27+
28+
julia> x isa NotProvidedType
29+
true
30+
31+
julia> x === NotProvided
32+
true
33+
```
34+
35+
See also: [`NotProvidedType`](@ref).
36+
"""
37+
const NotProvided = NotProvidedType()
38+
39+
Base.show(io::IO, ::NotProvidedType) = print(io, "NotProvided")

src/Options/not_provided.jl

Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,5 @@
1-
# NotProvided sentinel type
2-
#
3-
# Singleton type representing the absence of a default value for an option.
4-
5-
"""
6-
$(TYPEDEF)
7-
8-
Singleton type representing the absence of a default value for an option.
9-
10-
This type is used to distinguish between:
11-
- `default = NotProvided`: No default value, option must be provided by user or not stored
12-
- `default = nothing`: The default value is explicitly `nothing`
13-
14-
# Example
15-
```julia
16-
# Option with no default - won't be stored if not provided
17-
opt1 = OptionDefinition(
18-
name = :minimize,
19-
type = Union{Bool, Nothing},
20-
default = NotProvided,
21-
description = "Whether to minimize"
22-
)
23-
24-
# Option with explicit nothing default - will be stored as nothing
25-
opt2 = OptionDefinition(
26-
name = :backend,
27-
type = Union{Nothing, KernelAbstractions.Backend},
28-
default = nothing,
29-
description = "Execution backend"
30-
)
31-
```
32-
33-
See also: `OptionDefinition`, `extract_options`
34-
"""
35-
struct NotProvidedType end
36-
37-
"""
38-
NotProvided
39-
40-
Singleton instance of `NotProvidedType`.
41-
42-
Use this as the default value in `OptionDefinition` to indicate
43-
that an option has no default value and should not be stored if not provided
44-
by the user.
45-
46-
# Example
47-
```julia-repl
48-
julia> using CTBase.Options
49-
50-
julia> def = OptionDefinition(
51-
name = :optional_param,
52-
type = Any,
53-
default = NotProvided,
54-
description = "Optional parameter"
55-
)
56-
57-
julia> # If user doesn't provide it, it won't be stored
58-
julia> opts, _ = extract_options((other=1,), [def])
59-
julia> haskey(opts, :optional_param)
60-
false
61-
```
62-
"""
63-
const NotProvided = NotProvidedType()
64-
65-
# Pretty printing
66-
Base.show(io::IO, ::NotProvidedType) = print(io, "NotProvided")
1+
# NotProvided is defined in CTBase.Core and re-exported from here for backward compatibility.
2+
using CTBase.Core: NotProvided, NotProvidedType
673

684
"""
695
$(TYPEDEF)
@@ -78,21 +14,20 @@ default and was not provided by the user.
7814
This type is internal to the Options module and should not be used directly by users.
7915
Use `NotProvided` instead.
8016
81-
See also: `NotProvided`, `extract_option`
17+
See also: [`NotProvided`](@ref), [`extract_option`](@ref).
8218
"""
8319
struct NotStoredType end
8420

8521
"""
8622
NotStored
8723
88-
Internal singleton instance of `NotStoredType`.
24+
Internal singleton instance of [`NotStoredType`](@ref).
8925
9026
Used internally by the option extraction system to signal that an option should not
9127
be stored. This is distinct from `nothing` which is a valid option value.
9228
93-
See also: `NotProvided`, `extract_option`
29+
See also: [`NotProvided`](@ref), [`extract_option`](@ref).
9430
"""
9531
const NotStored = NotStoredType()
9632

97-
# Pretty printing
9833
Base.show(io::IO, ::NotStoredType) = print(io, "NotStored")

0 commit comments

Comments
 (0)