pnoltes commented on PR #711:
URL: https://github.com/apache/celix/pull/711#issuecomment-1876884143

   > I saw lots of `arrayList` replaced by `celix_arrayList`, but only saw very 
few `#include "celix_array_list.h"`, which suggests that we depend heavily on 
"transtive includes". Transtive includes often increase accidental 
complexities. Removing an include from a public header file may break a lot of 
downstream builds, thus lead to unhappy users. I suggest we follow John Lakos' 
advice to forbid transtive includes "except to access a public base class of a 
type whose definition is included directly".
   
   Also a good point. I do think this is more relevant for C++ code then for C 
code, but non the less also good to do for our C code. 
   If we forbid transtive dependencies, IMO we have to use forward declaration. 
So instead of including `celix_array_list.h` if a function returns or accepts a 
celix array list, we only need the following declaration:
   `typedef struct celix_array_list celix_array_list_t;
   I think it is then wise to define a guideline for this, something like:
   
   For a C object, the following header guideline should be followed:
    - The public api for a C object can can be found in a header named: 
`celix_<object_snake_name>.h`
    - The opaque typedefs (forward declaration) can be found in a header named: 
`celix_<object_name_name>_type.h`. This header ideally should only contain 
opaque typedefs, but can also contain concrete struct definition if needed 
(e.g. `celix_properties_entry_t` or `celix_properties_value_type_e`, etc)
    - If needed all private functions or structs (only used inside the library 
which provided the public api) can be found in a header named: 
`celix_<object_snake_name>_private.h`
    - If needed all internal functions or structs (only used inside the Apache 
Celix project, but not meant as public API), can be found in a header named: 
``celix_<object_snake_name>_internal.h`
   
   I also think this should be addressed in a separate ticket, if you agree I 
will make a ticket for this. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to