[erlang-questions] code:load_binary - why there's module as argument

Pierre Fenoll pierrefenoll@REDACTED
Mon Apr 16 20:57:10 CEST 2018


Semantically it ensures that the atom is already in the atom table. Now I
didn’t look at the code but maybe there is an assumption on this.
Send a PR maybe?

On Mon 16 Apr 2018 at 20:05, John Doe <donpedrothird@REDACTED> wrote:

> Fair enough, but it would be nice to have a version without such
> limitation.
>
> 2018-04-16 12:05 GMT+03:00 Attila Rajmund Nohl <attila.r.nohl@REDACTED>:
>
>> 2018-04-14 21:11 GMT+02:00 John Doe <donpedrothird@REDACTED>:
>>
>>> Hi all,
>>> I wonder why code:load_binary() requires module name as one of the
>>> arguments? The function would fail if this name is not equal to the real
>>> module name from the binary, so it can deduce the correct name. Why it does
>>> not allow loading just whatever module from a given binary and return
>>> something like {ok, moduleName} as the result?
>>>
>>
>> ​I guess to avoid overwriting an unexpected module. The input binary can
>> contain any code, if it pretends to be the list module, but the caller
>> thinks its the strings module, that could be a problem.​
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-- 

Cheers,
-- 
Pierre Fenoll
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180416/c6527bf1/attachment.htm>


More information about the erlang-questions mailing list