Boost logo

Boost Users :

From: Rainer Deyke (rdeyke_at_[hidden])
Date: 2020-05-30 14:11:47


Here is my non-review of LEAF.

As far as I am concerned, the only reason for LEAF to exist at all is
performance. Code that uses LEAF contains more syntactic noise than
code than the equivalent code using Boost.Exception, and is harder to
debug. The complex pattern matching aspect of LEAF seems like it could
occasionally be useful, but not not often enough to justify its
cognitive overhead. Almost all of my error handlers fall into one of
three categories:
   - Try something else.
   - Log the error, possibly show a message box, then ignore it.
   - Log the error, possibly show a message box, then terminate.
In none of these cases do I need any extra error information beyond the
basic type of the error, except for the purpose of converting the error
to a user-readable string that is then logged and possibly to the user
through a message box.

So, performance. Apparently some people use result<>-style return
values for performance reasons, because they cannot afford exceptions.
Apparently LEAF avoids dynamic memory when used with exceptions where
Boost.Exception does not, which all else being equal, should improve
performance. But LEAF has its own complex logic under the hood that
could have its own performance problems.

In theory, there is no reason why an ideal optimizer should create worse
binary code for a program using Boost.Exception than one using LEAF,
with or without exceptions. In practice, it could well be that LEAF
(especially LEAF with result<>) is much faster, but I have seen no
evidence of this. Nor do I consider myself competent to write a
benchmark to test this. I know enough about writing benchmarks to know
how easy it is to get them wrong, but not enough to avoid doing so.

So, since I am unable to determine whether what I consider the key
feature of LEAF is actually working as promised or not, I cannot in good
conscience vote to either accept or reject LEAF.

I realize that I am holding LEAF to a very high standard here. This is
because the problem that LEAF is trying to solve is so ubiquitous, and
the consequences of using LEAF are so far-reaching. It makes no sense
for a unified program to use LEAF in some subsystems but not in others.
I have to either embrace LEAF entirely or reject it entirely, and I
don't have enough information to make an informed choice.

-- 
Rainer Deyke (rainerd_at_[hidden])

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net