@@ -146,12 +146,15 @@ This library is an experiment and not intended for use. See the
146
146
of global knowledge. A ` static ` variable declaration must also be ` const ` ,
147
147
and if it's a pointer, then "deep constness" applies.
148
148
1 . No exceptions. Return results instead.
149
- * Every function and method is ` noexcept ` .
150
- * No use of ` throw ` .
149
+ * Every function and method is ` noexcept ` and/or ` consteval ` .
150
+ * No use of ` throw ` outside of ` consteval ` functions, where it is used to
151
+ provide compiler errors.
151
152
* Calls to functions in another library that can throw exceptions are
152
153
banned.
153
- * We will provide vocabulary types for returning a success-or-failure and a
154
- value-or-none.
154
+ * We will provide vocabulary types for returning a
155
+ [ success-or-failure] ( https://github.com/chromium/subspace/blob/main/result/result.h )
156
+ and a
157
+ [ value-or-none] ( https://github.com/chromium/subspace/blob/main/option/option.h ) .
155
158
1 . Traits, SFINAE and type tags to define behaviour on data. No inheritance
156
159
unless from an abstract interface. All other classes are marked ` final ` .
157
160
* Always use ` final ` instead of ` override ` .
@@ -162,12 +165,12 @@ This library is an experiment and not intended for use. See the
162
165
1 . Tools to use SFINAE for common patterns, such as traits, without having to
163
166
understand all of the stdlib type_traits.
164
167
1 . Use constexpr everywhere it is correct to.
165
- * Functions or method that can ever perform non- constexpr actions may not be
166
- marked constexpr, with the exception of: abort().
167
- * Any other function or method should be marked constexpr .
168
+ * Functions or method that can be constexpr should be marked constexpr.
169
+ * Use [ std::is_constant_evaluated ] ( https://en.cppreference.com/w/cpp/types/is_constant_evaluated )
170
+ to provide a (more expensive) constexpr implementation when needed .
168
171
1 . Common C++ language behaviours are part of the class' public API. We will
169
- document _ and test _ for being trivially copyable, movable, destructible,
170
- among others.
172
+ document _ and [ test ] ( https://github.com/chromium/subspace/blob/main/test/behaviour_types_unittest.cc ) _
173
+ for being trivially copyable, movable, destructible, among others.
171
174
1 . Everything comes with tests. Tests are not flaky.
172
175
1 . Avoid compiler-specific things whenever possible. Some exceptions:
173
176
* ` [[clang:trivial_abi]] ` is a perf benefit, once Clang has C++20 support.
@@ -194,12 +197,12 @@ This library is an experiment and not intended for use. See the
194
197
1 . Vocabulary types for returning success-or-failure with different embedded
195
198
types, or value-or-none.
196
199
1 . Tagged unions.
197
- 1 . We will provide a required set of clang warnings to get expected behaviour
200
+ 1 . We will provide a required set of compiler warnings to get expected behaviour
198
201
from the library when working with user-provided types.
199
202
* We will consider different "levels" of grouped warnings if needed.
200
203
1 . We will provide clang static analysis tools and/or compiler plugins as needed
201
204
to ensure expected behaviour from the library when it acts on user-provided
202
- types.
205
+ types (once clang supports C++20 and can compile the library) .
203
206
204
207
### Less clear ideas
205
208
0 commit comments