[erlang-patches] format_status analog for error_info

Steve Vinoski vinoski@REDACTED
Fri Feb 26 08:30:07 CET 2010


On Thu, Feb 25, 2010 at 11:31 AM, Andrew Thompson <andrew@REDACTED>wrote:

> On Thu, Feb 25, 2010 at 05:16:38PM +0100, Bj??rn Gustavsson wrote:
> > On Thu, Feb 25, 2010 at 4:56 PM, Andrew Thompson <andrew@REDACTED>
> wrote:
> > >
> > > Hah! gen_event actually uses the result of terminate() to start the new
> > > handler - I'd forgotten that. That makes things a lot more complicated.
> >
> > So perhaps it would be better to use Steve's approach?
> >
> > Other than that, I personally don't have any opinion yet on which
> > approach is the better one.
> >
>
> I'm inclined to agree - except that gen_event doesn't support the
> callback module having a format_status callback, at least not yet.
>
> In theory sys:get_status on a gen_event could call Mod:format_status for
> all its handlers with their respective states on their respective
> modules.
>

Nice idea -- I've implemented this in the patch I'm working on, and it works
just fine.

There's a backwards compatibility issue here, though: any event handler that
just happens to already export a format_status/2 fun for some other purpose
will find that sys:get_status calls on its gen_event module will, with this
change, result in unexpected calls to its format_status function. However,
this is no different than my original format_status patch for gen_server and
gen_fsm that's now part of R13B04 that started this thread, since any
gen_server or gen_fsm callback module that similarly just happened to export
a format_status/2 fun now finds with R13B04 that sys:get_status calls will
invoke that function. I think this is OK, though, since the likelihood of
this being pervasive in practice is almost certainly zero.

--steve


More information about the erlang-patches mailing list