API design and boolean flags
Ziggit
API design and boolean flags
Let us consider a basic API which has functions which have flags. e.g. fn action(..., enable_x: bool, enable_y: bool) { ... if (enable_x) { ... } if (enable_y) { ... } } and things of that variation. My mind came up with three forms to approach this. One is just the above, which is the clearest in terms of how the API behaves, but, without knowing how the compiler does its thing, makes it unclear how all those flags may be represented. E.g., naively, each of those flags could b...
0 comments
No comments yet.