sob., 4 maj 2024 o 18:44 g.peterhoff@t-online.de
Since you are asking this question on a Boost distribution list, I assume that you would like to get a Boost-like review of your library. One criterion for a Boost-quality library that I can offer is the quality of the documentation. A good documentation should:
* Briefly (in five minutes or less) convince the reader that it is worth investing time in studying the library, * Describe what computational problems it helps solving, * Convince that it will be a good fit in users' programs, * Demonstrate the usage, * Provide enough information that I know how to use it in my programs.
For now, having browsed the repo and read this thread, I do not know what I would need this library for. The only information that I got is that `bool3` is an "improved" version of Boost.Tribool. I do not know why anyone would use `bool2` or `bool4`. As a potential user I would like to know that. Could you show us some small programs, where using `bool4` actually helps? Similarly, can you show us the program example where using a weak negation makes the program cleaner or more efficient or less bug-prone?
I think this is the necessary step to enable more useful feedback and criticism.
Hello Andrzej, thank you for your comments. Here is a short answer. As I said, this library (like all boost libraries) is for general purposes.
Boost libraries, like Boost.Optional are indeed general-purpose, but if you look at their docs they will demonstrate why and when people might want to use them.
You could also ask why there is e.g. boost::math::quaternion/octonion. I don't know of a specific purpose for this either, but it makes sense to have them generally available.
Interesting. It looks like we have two quaternion implementations in Boost. The other being in Boost.QVM. It is nicely documented there, along with its motivation (for representing rotations in 3D space. The following thread demonstrates that people want it: https://groups.google.com/g/boost-developers-archive/c/gl4GxscZ1OU tribool is used in some booost libraries, which proves the usefulness of
bool3. You can also provide bool4/2, since the implementation is quite simple.
I think that a boost class - should be as complete as possible in terms of its operations/operators - should provide as many (if possible/useful) std operations as possible
Unfortunately tribool does not do that.
small documentation Because of the strange implementation of tribool::indeterminate, the classes are *not* compatible with tribool, as they should be in the same namespace. This is checked (static_assert). Compatibility could be achieved by: - bool4/3/2 in its own namespace (e.g. logic2) -> but I don't think that makes sense - typedef bool3 tribool; not checked implement bool4/3/2 - operator&& ooperator|| - operator! - operator~ weak negation; for bool2 this is identical to operator! - conversion constructors, where constructor(something) is deleted to prevent misuse - conversion operators for bool and unsigned - operator<< operator>> for streams, whereby boolalpha is taken into account; however, false is always returned for operator>> in the event of an error - to_(w)string like to_(w)string(bool) -> numeric result - numeric_limits - if available from/to_chars and/or boost::from/to_chars - if available formatter (but is still very simple) - the values are encapsulated and cannot be manipulated directly
There is really nothing more to say.
I have implemented the logical operators for bool4/3 using a table and for bool2 using bit operations. As already written, the tables should be checked again for correctness.
So it looks like you are saying that you wanted to provide a better tribool and bool2 and bool4 are just a byproduct of this endeavour. Is that right? Well I do not know why I would ever prefer `bool2` over just `bool`. For bool3 I can at least imagine a use case (true false and "I don't know"), but the docs do not give us any example that would show how the third state would be called. For `bool4` I do not even imagine how fthe four states would be called. The literature that you provide (the part that is not in german) offers at least two different models for four-state bool logic. What nming did you choose? Can the documentation show it? https://philosophy.stackexchange.com/a/97379 The above description says that for a three-value logic there are three kinds of negation: the standard one, the weak, and the strong. Give the rationale (in the documentation) why you provide only two. You use the two operators for the two negations. But your choice of symbols is absolutely arbitrary. It would be less error-prone if the other negations were named functions. Also, the documentation should say why you decided to put all the negation operations in the same type rather than offering three different types with different negation semantics. It is not clear to me if any use case requires all of these negation types together. Regards, &rzej;
regards Gero