Should abstract types be exported?

Someone could explain better but:

  1. You can create new methods for functions in other module.
  2. You can create your own functions using concrete types of other modules.

Consequently, it seems to me that exporting abstract structs is only useful if:

  1. It is clear which are the functions that any new subtypes of your exported abstract types should implement.
  2. You wanna allow for the users to both:
    1. Create new subtypes of your abstract types that will work automatically with any generic/fallback functions you have written.
    2. Allow them to write generic/fallback functions for your abstract types, i.e., they can write functions that can be extended for specific concrete types, but already have a generic implementation that should work for any subtype of your abstract type anyway.
4 Likes