Does anyone here know why many of the functions in the v8 API return MaybeLocal
handles instead of simply Local
types?
I understand that calls can fail, but the Local
type already has an IsEmpty()
method that could be easily queried anyways, and if one was already rigorously testing to see if Local
types were empty before using them whenever they were returned by any v8 API functions in the older API, then MaybeLocal
in the new API seems needlessly redundant. Short of sticking to an obsolete and no longer supported version of the v8 API, it seems there is no choice but to jump through the hoops of using MaybeLocal
.
I'm just wondering what the rationale was for it, particularly since, as I said, you could already test a Local
to see if it was empty anyways, and especially since trying to convert a MaybeLocal
that is empty to a Local
will outright crash the application.