Difference between type Foo and abstract type Foo

#1

What is the difference?

0 Likes

#2

An abstract type cannot be instantiated (in theory… right now the JS type system doesn’t enforce that, but you should not do AbstractType.make() as it might fail in the future.)

0 Likes

#3

I am still unclear on when to use just type and when to use abstract type.

0 Likes

#4

I have not found ‘abstract type’ to provide any value. Don’t use it.

1 Like

#5

Theoretically, it should not make sense to instantiate an abstract type, for example, because something is missing. One way to come up with an abstract type is to refactor two concrete types by putting their common parts into an abstract one that cannot be used alone.

2 Likes