Open
Description
This is a (possibly incomplete) list of rules that I think we should apply to our bindings. All rules should lead to easier navigation and to minimizing the binding surface. Rules which don't serve this purpose... well should not be here. If there's a way to make something better organised but more verbose - I'm all for it but there has to be an automated way to verify if we follow the rule!
- Don't use
.h
files unless we need to expose a symbol to other callers in the C universe - Always prefix stubs which are exposed to OCaml using
ml_
- Don't prefix stubs with
_stubs.(h|c)
. They are in the stubs directory anyway. - Name stub files the same as we call corresponding bindings on the OCaml side (makes it much easier to navigate the codebase at the beginning) with
"Brisk"
prefix. - On the OCaml side, use separate files for different components. The name should always match the
.c
file- "Brisk" prefix
. - Put
stub
files instubs
directory and OCaml bindings inbindings
directory - Avoid adding stuff to
BriskCocoa.c
. - Don't create files like
Cocoa_helpers_stubs.c
. Searching by file name gets confusing. Even if a file is supposed to contain just one binding/function, it's better to name it properly. LikeBriskColor.h
- Do not forget to expose new bindings and components in top-level
Brisk_macos
module (if needed). - Prefer putting stuff in
Objective-C
over C. If a function is not exposed to OCaml it's preferable to put it in a category or a Class itself (if it's an internal class to Brisk).