AbstractMyType or just MyType for abstract types?


For the naming of an abstract type (MyType), should I use AbstractMyType or just MyType for abstract types?

Base is using the former, some packages are using the latter. I remember someone telling that once it was not possible to have MyType as abstract type name and MyType() as constructor or callable type.

A side note, if abstract types would be highlighted somehow in the editors some of the disadvantages would disappear.

Is there someone with a clear perspective on this subject?


I don’t think there is a rule, and it will depend on your case. I think if you work mostly with the concrete types then having a AbstractMyType is good and vice-versa.

Not always, e.g. Associative is an abstract type.

Also of note is the rename FloatingPoint -> AbstractFloat, which may give you some hints with your decisions:




I am also questioning myself about this convention sometimes. Currently I am adopting the Abstract prefix to make this abstraction very explicit throughout the codebase and to help with auto-completion on my text editor.

However, as @mauro3 mentioned, if you are manipulating these abstract types all the time as your primary package types, then removing the prefix may save you some typing.

It is a matter of taste :slight_smile: