abstract type Foo end
struct FooA <: Foo
x
end
struct FooB <: Foo
x
end
I want to disallow any other concrete types of Foo
. Is that possible?
abstract type Foo end
struct FooA <: Foo
x
end
struct FooB <: Foo
x
end
I want to disallow any other concrete types of Foo
. Is that possible?
Not really. What is your use case for that?
if you are using Foo for dispatch, you could do:
struct FooA
x
end
struct FooB
x
end
const Foo = Union{FooA,FooB}
that will make Foo
impossible to extend, but available for dispatch