On Sat, Jun 16, 2018 at 12:46 AM Stephan Beal <sgb...@googlemail.com> wrote:

> i will write a longer response when i'm back on the PC, but short version:
>
> - refactoring to a lib is a huge effort.
> ...
> More details upcoming about that first point in the morning.
>

So...

http://fossil.wanderinghorse.net/r/libfossil

that's now effectively defunct, though, as i've been on medical leave for
RSI most of the past 3.5 years and am currently on track to be forced
into early retirement within the next couple of months.

Several aspects of fossil make it very tedious (but not difficult, per se)
to port to a library:

1) it uses a great deal of global state. That's simple enough to factor
into a Context object, but...

2) it relies on a fail-fast-and-fail-loud allocator. Any allocation error
will immediately (intentionally) crash the app. While that saves literally
half (sometimes more) of code/error checking any place where memory is
allocated (that's a lot of places), that pattern is unusable for libraries.
Granted, allocation errors are rare, but every single C call which
allocates has to check for failure or risk Undefined Behaviour. To simplify
the vast majority of the implementation, Fossil does this checking in a
single place and abort()s the app if an allocation fails.

3) Fossil effectively uses exit() to handle just about any type of
non-allocation error. i.e. there's little library-friendly error handling
in fossil.

4) Last but not least: Fossil implements a great many intricate algorithms
which, if not ported 100% perfectly, could lead to all sorts of Grief, some
of it difficult to track down. Such ports typically require 2x as much
code, sometimes more, because of the addition of error checking and
handling (as opposed to using abort() and exit()).

libfossil had essentially all of the core-most functionality running
(documented,
too) when RSI knocked me out, and was mainly missing network-related
functionality. It took, according to the timeline, about 16 months to get
it to that point (noting that i also worked on other projects at the time,
so that's not "16 months of effort"). My plan was to pick it back up when
my RSI problems passed, but whether they will is now an open question. In
the mean time, the SHA-related changes have made libfossil incompatible
with fossil, meaning that it would be much more difficult to get it back up
and running.

i would be thrilled to see someone implement a library for fossil, but
anyone doing so needs to understand, in advance, that it's a large
undertaking.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to