Before OTP 19.0, if the on_load directive fails, any previously loaded
code would become old, essentially leaving the system without any
working and reachable instance of the module. This is not true anymore
since OTP 19.0, so loading the nifs within the on_load directive is
today the cleanest and best code pattern.
It seems indeed very convoluted to have an entire application and
supervision tree with a worker gen_server just to load the nifs. Also,
one of the `handle_info` heads of the gen_server is even a remnant of
the times when `fast_tls` was implemented as a port driver instead of as
nifs, which is a high sign this needed some modernisation.
I'm not sure if you have any backwards-compatibility related reason to keep this whole app-supervisor-gen_server logic, but it seems convoluted, overly verbose, and quite redundant to me, so I'd argue very much in favour of this more modern way 🙂
As described in the commit:
I'm not sure if you have any backwards-compatibility related reason to keep this whole app-supervisor-gen_server logic, but it seems convoluted, overly verbose, and quite redundant to me, so I'd argue very much in favour of this more modern way 🙂