changeset 1906:447ea06bfa07 feature/grids/parameter_spaces

Make promoting constructor for Interval an outer constructor
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 01 Feb 2025 22:48:13 +0100
parents 238ef43fe92a
children 09c4fda8779d
files src/Grids/parameter_space.jl
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/Grids/parameter_space.jl	Sat Feb 01 22:46:23 2025 +0100
+++ b/src/Grids/parameter_space.jl	Sat Feb 01 22:48:13 2025 +0100
@@ -27,11 +27,16 @@
 struct Interval{T} <: ParameterSpace{1}
     a::T
     b::T
+end
 
-    function Interval(a,b)
-        a, b = promote(a, b)
-        new{typeof(a)}(a,b)
-    end
+"""
+    Interval(a,b)
+
+An interval with limits `a` and `b`.
+"""
+function Interval(a,b)
+    a, b = promote(a, b)
+    Interval{typeof(a)}(a,b)
 end
 
 """