Skip to content

Commit 58febb2

Browse files
authored
Update PRINCIPLES.md
Update some text and links
1 parent 9d0ae90 commit 58febb2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

PRINCIPLES.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,15 @@ This library is an experiment and not intended for use. See the
146146
of global knowledge. A `static` variable declaration must also be `const`,
147147
and if it's a pointer, then "deep constness" applies.
148148
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.
151152
* Calls to functions in another library that can throw exceptions are
152153
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).
155158
1. Traits, SFINAE and type tags to define behaviour on data. No inheritance
156159
unless from an abstract interface. All other classes are marked `final`.
157160
* Always use `final` instead of `override`.
@@ -162,12 +165,12 @@ This library is an experiment and not intended for use. See the
162165
1. Tools to use SFINAE for common patterns, such as traits, without having to
163166
understand all of the stdlib type_traits.
164167
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.
168171
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.
171174
1. Everything comes with tests. Tests are not flaky.
172175
1. Avoid compiler-specific things whenever possible. Some exceptions:
173176
* `[[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
194197
1. Vocabulary types for returning success-or-failure with different embedded
195198
types, or value-or-none.
196199
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
198201
from the library when working with user-provided types.
199202
* We will consider different "levels" of grouped warnings if needed.
200203
1. We will provide clang static analysis tools and/or compiler plugins as needed
201204
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).
203206

204207
### Less clear ideas
205208

0 commit comments

Comments
 (0)