Re: Suicide by module_info

Richard Carlsson <[email protected]> Sun, 26 Apr 2015 22:46:54 +0200
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CANKG3zkc2mXTyL=Dis60vdhPjLJ=kpa1gkK6MyiDcC+S_k8udg@mail.gmail.com>
On Sun, Apr 26, 2015 at 10:40 PM, Tuncer Ayaz <[email protected]> wrote:

> Could it be that erlang:get_module_info/1 is undocumented and
> therefore underused? I don't think I ever called get_module_info/1 and
> I suspect everyone just uses foo:module_info/0,1, which interestingly
> works after a successful code:delete(foo) call.
>
> The crash is a bug, but this might explain how it went unnoticed.
>
> Do you think the following is the right behavior?
>
> > c(foo).
> {ok,foo}
> > code:delete(foo).
> true
> > foo:module_info().
> [{module,foo},
> ...]
>
> I mean, I would expect fully qualified calls to foo:module_infi/0 to
> fail once code:delete(foo) succeeds. Or is this how it's supposed to
> behave?
>

That's how things are supposed to work. If the foo is deleted when you call
foo:module_info(), it will simply get reloaded and then called, just as if
foo had not been previously loaded at all.

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs